-
Notifications
You must be signed in to change notification settings - Fork 0
/
Unfriendly.c
39 lines (32 loc) · 856 Bytes
/
Unfriendly.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
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#define DIM 1500
void main()
{
int i,j,sum=0;
int **a = (int **)malloc(DIM * sizeof(int *));
for(i=0;i<DIM;i++)
a[i] = (int *)malloc(DIM * sizeof(int));
int **b = (int **)malloc(DIM * sizeof(int *));
for(i=0;i<DIM;i++)
b[i] = (int *)malloc(DIM * sizeof(int));
int **c = (int **)malloc(DIM * sizeof(int *));
for(i=0;i<DIM;i++)
c[i] = (int *)malloc(DIM * sizeof(int));
for(int i=0;i<DIM;i++)
for(int j=0;j<DIM;j++)
a[i][j] = i+j;
for(int i=0;i<DIM;i++)
for(int j=0;j<DIM;j++)
b[i][j] = i+j;
for(int i=0;i<DIM;i++)
for(int j=0;j<DIM;j++)
c[i][j] = 0;
#pragma omp parallel for
for(int i=0;i<DIM;i++)
for(int j=0; j<DIM;j++)
for(int k=0; k<DIM ; k++)
c[i][j] = c[i][j] + a[k][j] + b[k][j];
printf("c[56][500]=%d\n", c[56][500]);
}