Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this course, we will use C for the OpenMP, GPU and MPI programming. This exercise will refresh your memory about C programming. Please write
In 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started