c - Sum of an array element using OpenMP -


i trying parallelize following nested "for loops" (in c) using openmp.

for (dt = 0; dt <= maxdt; dt++) {   (t0 = 0; t0 <= nframes-dt; t0++) {     (i=0; i<natoms; i++) {       vac[dt] = vac[dt] + dot_product(vect[t0][i],vect[t0+dt][i]) ;     }   } } 

basically calculates auto-correlation function of time dependent vector (vect). need vac array final output using openmp.

i have tried using reduction sum approach of openmp perform this, adding following line above innermost loop (for (i=0; i<natoms; i++)).

#pragma omp parallel default(shared) private(i,axis) schedule(guided) reduction(+: vac[dt]) 

but not work, since reduction sum not work arrays. best , efficient way parallelize such codes? thanks.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -