]> vgcfreebox.myrthtech.pt Git - ue-pp-squarematrixparallelisation.git/blob - SequencialMatrixSearch.c
blocks strategy
[ue-pp-squarematrixparallelisation.git] / SequencialMatrixSearch.c
1 #include <stdio.h>
2 #include <pthread.h>
3
4 const int m_rows = 40000;
5 const int m_cols = m_rows;
6 int hv = 0;
7 int matrix[m_rows][m_cols];
8
9
10 int main(void){
11 printf("Populate the matrix\n");
12 for(int r = 0; r < m_rows; r++){
13 for(int c = 0; c < m_cols; c++){
14 matrix[r][c] = r*m_cols+c;
15 }
16 }
17
18 printf("Search matrix \n");
19 for(int rr = 0; rr < m_rows; rr++){
20 for(int cc = 0; cc < m_cols; cc++){
21 if(matrix[rr][cc] > hv){
22 hv = matrix[rr][cc];
23 }
24 }
25 }
26
27 printf("Done\n The biggest value found is %d", hv);
28 return 0;
29 }
30
31