|
|
@ -2,6 +2,7 @@ |
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
#include <omp.h>
|
|
|
|
#include "Ttiming.h"
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
|
|
|
@ -37,6 +38,8 @@ int main(int argc, char *argv[]) |
|
|
|
long rozmiar=0; |
|
|
|
char *endptr; |
|
|
|
int threads_num=0; |
|
|
|
TTiming tt; |
|
|
|
long i, j;//,k;
|
|
|
|
|
|
|
|
if (argc < 3) |
|
|
|
{ |
|
|
@ -89,10 +92,23 @@ int main(int argc, char *argv[]) |
|
|
|
for (long i=0; i<rozmiar; ++i) |
|
|
|
for (long j=0; j<rozmiar; ++j) |
|
|
|
B[i][j] = (long)(cos(j) *(i+j)) % 10; // postarac sie to zoptymalizowac!
|
|
|
|
|
|
|
|
//mnozenie macierzy - TO DO
|
|
|
|
|
|
|
|
|
|
|
|
tt.Begin(); |
|
|
|
//#pragma omp parallel for default(shared)
|
|
|
|
#pragma omp parallel for default(none) shared(A, B, C) firstprivate(rozmiar)private(i, j)
|
|
|
|
for (i=0; i<rozmiar; ++i) |
|
|
|
for (j=0; j<rozmiar; ++j) |
|
|
|
{ |
|
|
|
C[i][j] = 0; |
|
|
|
for (long k=0; k<rozmiar; ++k) |
|
|
|
C[i][j] += A[i][k]*B[k][j]; |
|
|
|
} |
|
|
|
|
|
|
|
long elapsed = tt.End(); |
|
|
|
|
|
|
|
cout << "Time: " << elapsed << " ms" << endl; |
|
|
|
|
|
|
|
|
|
|
|
array_destroy(A); |
|
|
|
array_destroy(B); |
|
|
|
array_destroy(C); |
|
|
|