Previous | ToC | Next |
2004/8/27 HTML 版メモ 牧野
PGHPF の動作確認が一応できましたので、簡単な使い方を
あまり意味があるプログラムではありませんが、以下を test.hpf という名前 でもっているとします。
program example1 parameter(n = 50000000) real x(n), dot !hpf$ processors p(4) !hpf$ distribute x(block) onto p do i=1,n x(i)=1.0e0/float(i) end do dot=0.0e0 do j=1,10 do i=1,n dot=dot+x(i)*x(i) end do print *, j, ' dot = ',dot enddo stop end !hpf$ processors p(4)
が、 4 プロセッサを1次元配列で使うという宣言だそうです。 プロセッサ数を実行時に変える方法は良くわかってないです。
マニュアルは
grape.astron.s.u-tokyo.ac.jp/pub/people/makino/tmp/pgi/
にあります。
a) SMP 動作の場合
## pghpf -fast test.hpf -o hpftest NOTE: your evaluation license will expire in 14 days, 11 hours. For a permanent license, please read the order acknowledgement that you received. Connect to https://www.pgroup.com/License with the username and password in the order acknowledgement. ....
## hpftest -pghpf -np 4 -stat cpus 1 dot = 1.644725 2 dot = 3.289451 3 dot = 4.934176 4 dot = 6.578901 5 dot = 8.223627 6 dot = 9.868353 7 dot = 11.51308 8 dot = 13.15780 9 dot = 14.80253 10 dot = 16.44726 FORTRAN STOP cpu real user sys ratio node 0* 1.27 0.64 0.04 54% hanawa0 1 1.18 0.52 0.04 48% hanawa0 2 1.26 0.64 0.06 56% hanawa0 3 1.21 0.46 0.10 46% hanawa0 min 1.18 0.46 0.04 avg 1.23 0.57 0.06 max 1.27 0.64 0.10 total 1.27 2.26 0.24 1.97x
最後の -stat cpus は cpu 時間の統計を出すものです。 2CPU しかないのに 4 CPU を要求してますが、なんか実行してます。
b) MPI の場合
## pghpf -Mmpi -fast test.hpf -L/opt/mpich/1.2.5.2/pgi-p4/lib -o hpftest NOTE: your evaluation license will expire in 14 days, 10.9 hours. For a permanent license, please read the order acknowledgement that you received. Connect to https://www.pgroup.com/License with the username and password in the order acknowledgement.
.….
## mpirun -np 4 hpftest -pghpf -np 4 -stat cpus 1 dot = 1.644725 2 dot = 3.289451 3 dot = 4.934176 4 dot = 6.578901 5 dot = 8.223627 6 dot = 9.868353 7 dot = 11.51308 8 dot = 13.15780 9 dot = 14.80253 10 dot = 16.44726 FORTRAN STOP cpu real user sys ratio node 0* 0.75 0.50 0.04 72% hanawa0 1 0.71 0.61 0.05 93% hanawa1 2 0.66 0.54 0.04 88% hanawa2 3 0.67 0.61 0.05 99% hanawa3 min 0.66 0.50 0.04 avg 0.70 0.56 0.04 max 0.75 0.61 0.05 total 0.75 2.26 0.18 3.25x
コンパイルオプションに
-Mmpi -fast -L/opt/mpich/1.2.5.2/pgi-p4/lib
実行時に
mpirun -np xx
を付けるだけでいいようです。
Previous | ToC | Next |