Question: Template Code #include #include #include #include #define DEBUG 0 /* ----------- Project 2 - Problem 1 - Matrix Mult ----------- This file will multiply two
Template Code
#include
#define DEBUG 0
/* ----------- Project 2 - Problem 1 - Matrix Mult -----------
This file will multiply two matricies. Complete the TODOs in order to complete this program. Remember to make it parallelized! */ // ------------------------------------------------------ //
int main(int argc, char* argv[]) { // Catch console errors if (argc != 10) { printf("USE LIKE THIS: parallel_mult_mat_mat mat_1.csv n_row_1 n_col_1 mat_2.csv n_row_2 n_col_2 num_threads results_matrix.csv result_maximum.csv time.csv "); return EXIT_FAILURE; }
// Get the input files FILE* inputMatrix1 = fopen(argv[1], "r"); FILE* inputMatrix2 = fopen(argv[4], "r");
char* p1; char* p2;
// Get matrix dimensions
int n_row1 = atoi(argv[2]);
int n_col1 = atoi(argv[3]);
int n_row2 = atoi(argv[4]);
int n_col2 = atoi(argv[5]);
// Get num threads int thread_count = strtol(argv[7], NULL, 10);
// Get output files
FILE* outputMax = fopen(argv[8], "w"); FILE* outputFile = fopen(argv[9], "w"); FILE* outputTime = fopen(argv[10], "w");
long int *A = (long int*) malloc(n_row1 * n_col1 * sizeof(long int));
long int *B = (long int*) malloc(n_row2 * n_col2 * sizeof(long int));
long int *C = (long int*) malloc(n_row1 * n_col2 * sizeof(long int));
FILE* fp1 = fopen(input_file, "r"); for (int i = 0; i
}
Note: please use omp for parallelization 
In this problem, let us practice the join by reduction in the embarrassingly parallel pattern using he matrix-matrix multiplication result. Problem 2A. [10 points for CS4473 and CS5473] Please implement a parallel program to find the maximum value in the output matrix from a natrix-matrix multiplication. To save memory, you cannot compute and store the entire output natrix in the memory and then search for the maximum from the completed output matrix. Instead, you need to find the maximum as each element in the output matrix is computed as shown in the pseudo-code below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
