# Some help for Red black SOR with OpenMP

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 4, 2006, 09:26 Some help for Red black SOR with OpenMP #1 Davoche Guest   Posts: n/a Hi everybody, I'm trying to parallelize ( with OpenMP ) a Numerical recipes routine. In fact, this is a Red black SOR algorithm. But I don't know how to begin... If somone could help me for this first experience... Davoche PS: You can find the algorithm below ************************************************** ph():represent the 3D quantity to solve res(): is the source term omeg : is the relaxation parameter ************************************************** * kjsw=1 do ipass=1,2 isw=kjsw do 14 k=2,n3x do 14 j=2,n2y do 13 i=isw+1,n1z,2 fj=(-(ph(i+1,j,k)+ph(i-1,j,k) +ph(i,j-1,k)+ph(i,j+1,k) +ph(i,j,k+1)+ph(i,j,k-1))+res(i,j,k)) ph(i,j,k)=omeg*(fj/6)+(1.d0-omeg)*ph(i,j,k) 13 continue isw=3-isw 14 continue kjsw=3-kjsw 15 continue

 February 5, 2006, 17:19 Re: Some help for Red black SOR with OpenMP #2 AnotherCFDUser Guest   Posts: n/a Parallelize the inner loop (there are no data dependencies as far as I can tell). The speed-up you will get will depend upon the size of the maximum index in the loop. I forget the exact syntax but something like: !\$OMP PARALLEL DO (PRIVATE i,fj) . . . !\$OMP END PARALLEL DO should be about right.