Question: I need help with task 4 in my Parallel Computing lab All mandatory tasks are due. o Task 4: Matrix multiplication in C on Wolfgand

 I need help with task 4 in my Parallel Computing lab

All mandatory tasks are due. o Task 4: Matrix multiplication in C

on Wolfgand cluster with OpenMP (easy, try mmult_omp_timing) o Task 5: Matrix

I need help with task 4 in my Parallel Computing lab

All mandatory tasks are due. o Task 4: Matrix multiplication in C on Wolfgand cluster with OpenMP (easy, try mmult_omp_timing) o Task 5: Matrix multiplication in C on Wolfgand cluster with MPI (Distributed Memory) o Produce graph (for algorithms in Task 2, 3, 4 and 5 all in one) Task 4: OpenMP mmult_omp.c is included in the provided code Incorporate this function into your scheme for automatically running matrix multiplication and generating data 6 7 #include #include #include #include 8 9 10 11 #include "mat.h" 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 int main(int argc, char* argv[]) { struct timespec start; struct timespec end; struct timespec res; double *a, *b, *c1, *c2; int n; double times [2]; if (argc > 1) { n = atoi(argv[1]); a = gen_matrix(n, n); b = gen_matrix(n, n); c1 = malloc(sizeof(double) * n * n); c2 = malloc(sizeof(double) * n * n); clock_gettime (CLOCK_REALTIME, &start); mmult(ci, a, n, n, b, n, n); clock_gettime (CLOCK_REALTIME, &end); times [0] = deltaTime(&start, &end); printf("%d %f", n, times [0]); clock_gettime (CLOCK_REALTIME, &start); mmult_omp(c2, a, n, n, b, n, n); clock_gettime (CLOCK_REALTIME, &end); times [1] = deltaTime(&start, &end); printf("%f", times [1]); printf(" "); compare_matrices(c1, c2, n, n); } else { fprintf(stderr, "Usage %s ", argv[0]); } }

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!