Question: program in java Part 1: Parallel Matrix Muito calon using Java Threads Given two matrices of sm x T and n xp, write any program

program in java program in java Part 1: Parallel Matrix Muito calon using Java Threads

Part 1: Parallel Matrix Muito calon using Java Threads Given two matrices of sm x T and n xp, write any program using threads that camputo the multiplication of the two matrice in n parallel fashion. An example of matrix multiplication in given below where a 2 x 3 matrix in multiplied by - 3 x 2 matrix giving a 2x2 matrix as the result (call it the product matrix) The (1,1) cell in this matrix in generated from the sum by taking the ith row of the first matrix and multiplying och element by its corresponding element in the jth column of the second matrix 9 11 10 12 [(1.7+2.9+311) (1 8+2 -10 +3.12)] [(4.7+5+9+611) (4.8+5.104-6.12) You should parallelize the program by assigning each thread some number of rows of the product matrix that it should compute. For example, if the product matrix is 10 x 10 and there are two threads, the first threads should compute rows 1 to 5 and the second thread should computerowe 6 to 10. For this assignment, each thread should know which rows it is responsible for computing when it is initially created. This should mean you do not have to worry about any synchronization or locking of shared data as no two threads should be writing to the same locations. Your program should be capable of splitting the work up among n threads where 1 ns the number of rows in the product matrix How many threads are created should be specified as an input parameter to your program. Make sure you also consider the edge case when n = 1. In addition to the problem solution, add the ability to calculate how long it takes your program to run. This should be the time from when the first worker thread starts to when all the threads are finished. The general structure of your main method should look something like: 1. Create test matrices 2. Start timer 3. Create threads 4. Start threads I UNBC CPSC 222 - Winter 2020 5. Wait for all threads to finish 6. Stop timer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!