CSE 1325 UTA Benchmarking Parallel Processing Using Java Program

CSE 1325: Object-Oriented ProgrammingUniversity of Texas at Arlington
Summer 2021
Dr. Alex Dillho
Extra Credit
Benchmarking Parallel Processing
In this assignment, you will be benchmarking the time it takes to perfrom tasks in parallel
using multiple threads versus using a single thread.
Matrix Multiplication
Matrix multiplication is an extremely common operation that is used in many highperformance computing applications. For example, articial neural networks perform
many matrix multiplications while computing output and while training. Your code
should benchmark this task, which means you will need to implement the operation. The
Java API does not provide this operation natively.
You can implement matrix multiplication following the denition as seen here:
https://en.wikipedia.org/wiki/Matrix_multiplication
Your implementation should end up as a nested for-loop with 3 loops total. That is, the
rst loop iterates over the rows of A using i. The second loop iterates over the columns
of B using j . The third loop sums the products of the values using k.
n
X
cij = aik bkj
k=1
For simplicity’s sake, you can assume the matrices
A
and
B
are square and of
This implies that the output matrix C will also be square and of the
same size as A and B .
the same size.
BONUS (10 points):
Implement matrix multiplication to work with non-
square matrices.
Multi-Threading
To compare the time it takes to compute batch operations of matrix multiplication using multiple threads versus a single thread, your program should be able to start many
threads. Each thread will perform matrix multiplication on two matrices and update a
shared 3D array. The user should be able to input the number of batch items to benchmark when the program starts, not to exceed 128 items.
CSE 1325: Extra Credit
Dillho
If the user enters 64, then your code should benchmark the time it takes to multiple 64
sets of matrices. The results would be stored in a 3D array. The user should also be
able to specify the size of the matrices.
If you implement the bonus above,
add input for the size of matrix A and size of matrix B.
As an example, if the user wanted to benchmark the time it takes to multiply 64 pairs of
square matrices that are 10×10, the resulting 3D output array should be of size 64×10×10.
Your program should launch 64 threads that will perform matrix multiplication on one
pair of matrices.
Benchmarking
When benchmarking linear versus parallel computation. You should use System.nanoTime()
as shown below.
long startTime = System.nanoTime();
// Perform some computation
long endTime = System.nanoTime();
long timeInMs = TimeUnit.NANOSECONDS.toMillis(endTime – startTime);
Your program will rst benchmark the time it takes to perform this on a single thread
before benchmarking the time it takes using multi-threading. Report both times to the
console before exiting.
Submission
Create a zip le using the name template LASTNAME_ID_EC.zip which includes the required .java les. Submit the zip le through Canvas.
2

Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order