Question: bIn this course, we will use C for the OpenMP, GPU and MPI programming. This exercise will refresh your memory about C programming. Please write
bIn this course, we will use C for the OpenMP, GPU and MPI programming. This exercise will refresh your memory about C programming. Please write a serial C program to do the matrixvector multiplication.
Implementation requirements:
Because the input matrix and vector can be very large, you must use dynamic memory allocation ie malloc and free to store them in the heap. If your implementation stores the input matrix, the input vector, or the output vector in the stack, we will deduct points.
There are many ways to store the matrix in a dynamically allocated dimensional array in C including a using the rowmajor order or columnmajor order in a dimentional array or b using an array of pointers to a set of dimensional arrays. In this exercise, please store the matrix in a dynamically allocated dimensional array in the rowmajor order points
To help you meeting the two implementation requirements, we have provided a toy C program that dynamically allocates a D array stored by rowmajor order. This C program is called arrayallocation.c under the Problem subdirectory.
Your matrixvector multiplication program should take two input files, one for the input matrix and the other one for the input vector. All the numbers are integers. The two input files are provided in the commaseparated values CSV format. To prevent the numbers from running out of range, please declare the type of all variables as long int. The output vector should be saved in a CSV file.
Your program should be run using the following command line:
serialmultmatvec filecsv nrow ncol filecsv nrow resultvector.csv
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
