Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- #include<pthread.h>
- #include <unistd.h>
- #include <omp.h>
- #include <time.h>
- #include <omp.h>
- int main(int argc, char *argv[]) {
- int n=100000000,zarodek,i,j,k;
- time_t tt;
- //#pragma omp parallel for schedule(static) shared (a,b,result) private(i,j,k)
- double *a, *b, *result;
- srand(time(NULL));
- a=malloc(n*sizeof(double));
- b=malloc(n*sizeof(double));
- result=malloc(n*sizeof(double));
- for(i=0; i<n;i++){
- a[i]=rand()%50;
- b[i]=rand()%50;
- }
- double start = omp_get_wtime();
- for(i=0; i<n;i++)
- result[i]=a[i]*b[i];
- double time = omp_get_wtime() - start;
- printf(" CZAS BASIC: %g\n ", time);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement