-
Notifications
You must be signed in to change notification settings - Fork 0
/
project1.c
executable file
·77 lines (58 loc) · 1.7 KB
/
project1.c
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
============================================================================
Name : project1.c
Author : Julian Fietkau
Copyright : Julian Fietkau
Description : Matrix Multiplikation
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include "test.h"
#include "matrix.h"
#include "openMP.h"
#include "pThreads.h"
#include "openMPI.h"
#include <mpi.h>
/*
* make a small benchmark testcase and bench our 4 implementations
*/
int main( int argc, char* argv[] ){
// Initialize the MPI environment
MPI_Init(&argc, &argv);
// run all testcases with all 4 implementations
test(1);
test(2);
test(3);
test(4);
// decalre some easy problemsets 4 benching all implemenations & run
int problemset_easy[5] = { 10, 50, 100, 500, 750};
matrix m1;
int i, size;
for(i=0; i < 5; i++) {
size = problemset_easy[i];
printf(" ================================================ \n");
printf(" ==========\t Problemsize : %d \t========= \n",size);
printf(" ================================================ \n");
createRandomMatrix(&m1,size,size);
bench(&m1,1);
bench(&m1,2);
bench(&m1,3);
bench(&m1,4);
}
// declare some hard problemsets 4 the parallel methods & run
int problemset_hard[2] = { 2000, 5000};
for(i=0; i < 2; i++) {
size = problemset_hard[i];
printf(" ================================================ \n");
printf(" ==========\t Problemsize : %d \t========= \n",size);
printf(" ================================================ \n");
createRandomMatrix(&m1,size,size);
bench(&m1,2);
bench(&m1,3);
bench(&m1,4);
}
MPI_Finalize();
destroyMatrix(&m1);
return EXIT_SUCCESS;
}