concurrency - omp parallel doesn't give any performance increase for matrix multiplication -


i'm using following 2 code blocks compute matrix multiplication serially , parallel.

serial -

double** ary1 = new double*[in]; double** ary2 = new double*[in]; double** result = new double*[in]; (int i=0;i<in;i++){     (int j=0;j<in;j++){         result[i][j] = 0;         for(int k = 0;k<in; k++){             result[i][j] += ary1[i][k]*ary2[k][j];         }     } } 

parallel -

double** ary1 = new double*[in]; double** ary2 = new double*[in]; double** resultsp = new double*[in]; #pragma omp parallel  for(int i=0;i<size;i++){   int raw = i/in;   int column = i%in;   double sum =0;   for(int k = 0; k < in; k++){        resultsp[raw][column] += ary1[raw][k]*ary2[k][column];   }   resultsp[raw][column] = sum; } 

i ran both in quad-core computer, same results. why don't performance increased running parrellely? accessing ary1, ary2, resultsp shared arrays inside parellel loop cause them run serially?

this has happened since '-fopenmp' flag hasn't included when compiling code. problem solved adding it.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -