Fortran での並列プログラミングでの共通ブロックの使用についていくつか質問があります。
サブルーチンには共通ブロックがあります。並列 do 領域ですべての共通ブロックと threadprivate を宣言する必要がありますか?
彼らはどのように情報を渡しますか? 各スレッドに個別の共通クロックが必要で、並列領域の最後まで情報を渡すようにします。ここで起こりますか?
私の
Ford
サブルーチンは共通ブロックのいくつかの変数を変更し、Condact
サブルーチンはそれらを再度上書きしますが、関数はCondact
サブルーチンからの値を使用します。2 番目のサブルーチンと関数は、各スレッドの前のサブルーチンから変数をコピーしますか?program ... ! Loop which I want to parallelize !$OMP parallel DO !do I need to declear all common block and threadprivate them here? I = 1, N ... call FORD(i,j) ... !$OMP END parallel DO end program subroutine FORD(i,j) dimension zl(3),zg(3) common /ellip/ b1,c1,f1,g1,h1,d1, . b2,c2,f2,g2,h2,p2,q2,r2,d2 common /root/ root1,root2 !$OMP threadprivate (/ellip/,/root/) !this subroutine rewrite values of b1, c1 and f1 variable. CALL CONDACT(genflg,lapflg) return end subroutine SUBROUTINE CONDACT(genflg,lapflg) common /ellip/ b1,c1,f1,g1,h1,d1,b2,c2,f2,g2,h2,p2,q2,r2,d2 !$OMP threadprivate (/ellip/) ! this subroutine rewrite b1, c1 and f1 again call function f(x) RETURN END function f(x) common /ellip/ b1,c1,f1,g1,h1,d1, . b2,c2,f2,g2,h2,p2,q2,r2,d2 !$OMP threadprivate (/ellip/) ! here the function uses the value of b1, c1, f1 from CONDAT subroutine. end