-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
27 lines (22 loc) · 693 Bytes
/
main.c
File metadata and controls
27 lines (22 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include "lib/matrix_lib.h"
#include <string.h>
#include "lib/sparse_lib.h"
int main(int argc, char **argv)
{
char A_matrixname[100];
char B_matrixname[100];
char resultname[100];
MPI_Init(&argc, &argv);
double start = -MPI_Wtime();
sprintf(A_matrixname, "data/%s", argv[1]);
sprintf(B_matrixname, "data/%s", argv[2]);
sprintf(resultname, "results/mul%son%snproc%s", argv[1], argv[2], argv[3]);
mpi_multiply_and_save_matrix(A_matrixname, B_matrixname, resultname);
double time_elapsed = start + MPI_Wtime();
printf("Time: %f\n", time_elapsed);
MPI_Finalize();
return 0;
}