Question: I have this code: #include #include #include #include #define N 1 0 0 0 / / Size of the matrices void multiplyMatrices ( double *
I have this code: #include
#include
#include
#include
#define N Size of the matrices
void multiplyMatricesdouble A double B double C int n
for int i ; i n; i
for int j ; j n; j
Cij;
for int k ; k n; k
Cij Aik Bkj;
int main
Allocate and initialize matrices A B C
double A new doubleN;
double B new doubleN;
double C new doubleN;
for int i ; i N; i
Ai new doubleN;
Bi new doubleN;
Ci new doubleN;
for int j ; j N; j
Aij rand;
Bij rand;
Record start time
auto start std::chrono::highresolutionclock::now;
Matrix multiplication
multiplyMatricesA B C N;
Record end time
auto end std::chrono::highresolutionclock::now;
std::chrono::duration duration end start;
std::cout "Execution time: duration.count seconds" std::endl;
Write result to file
std::ofstream resultFilematrixoutput.txt;
for int i ; i N; i
for int j ; j N; j
resultFile Cij;
resultFile
;
resultFile.close;
Free memory
for int i ; i N; i
delete Ai;
delete Bi;
delete Ci;
delete A;
delete B;
delete C;
return ;
I need to do these tasks Instructions
Modify your matrix multiplication program to use MPI to distribute work on nodes.
Evaluate the performance of your program vs sequential and multithreaded solution.
Modify your code to use OpenMP on the nodes.
Evaluate the performance of your program vs the other two.
Modify your code to use OpenCL.
Evaluate the performance of your programs.
Document your results and present your findings
Submit your task as detailed on the submission details section above to OnTrack.
Please make sure to provide the following:
Source code of the MPI matrix multiplication program,
Source code of the MPI and OpenMP hybrid MPI to nodes and OpenMP in the nodes program,
Source code of the MPI and OpenCL hybrid MPI to nodes and OpenCL in the nodes program, and
Evaluation of your program on different input sizes and number of threads in each of these three
programs.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
