Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a code in C using OpenMP to parallel program Matrix Multiplication: C=B*A where A, B, and C are matrices and * is matrix multiplication.

Write a code in C using OpenMP to parallel program Matrix Multiplication: C=B*A where A, B, and C are matrices and * is matrix multiplication. You may assume the matrices are all square with N rows and N columns. Assume there are K threads performing the computation. In this approach, each thread is statically assigned a set of rows of the result matrix C for which it is responsible for computing results. Specifically, thread 0 is responsible for computing values for rows 0, K, 2K, of C. Thread 1 computes values for rows 1, K+1, 2K+1, In other words, the rows of the matrix are assigned in round robin fashion to the different threads. Lastly, print out the performance of this code, i.e., the execution time. Your code should fill the matrix with random numbers in the interval [0.0, 1.0]. All values should be double precision floating point numbers.

NOTE: We cannot use "Pragma omp for" as it is a built in command from the openmp library that deals with race conditions for us. Theassignment calls for us to take care of the race conditions ourselves using a critical section.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago