c********************************************************************
c complete fortran code
program hello
IMPLICIT NONE
include 'mpif.h'
integer ierr
integer my_rank
integer p
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, my_rank, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, p, ierr)
write(6,900) p
900 format(' ','there are ', I1, ' processes')
if( my_rank .EQ. 0 ) then
write(6,*) 'hello world from process',my_rank
else
print *, 'hello world from other process'
endif
call MPI_FINALIZE(ierr)
stop
end program hello
c************************************************************
$ mpif77 -o hello hello.f
$ mpiexec -n 4 ./hello
there are 1 processes
hello world from process 0
there are 1 processes
hello world from process 0
there are 1 processes
hello world from process 0
there are 1 processes
hello world from process 0
what is wrong here? the program is supposed to simulate four CPUs. but there is only 1 process.
and the same message is printed four times. any1 can help??
fortran code, wrong output!!
- greco
- 帖子: 2487
- 注册时间: 2007-04-06 10:24
- 来自: ~/Shanghai
哇 fortran,不会
http://silenceisdefeat.com/~greco
代码: 全选
''.join([chr(ord(c)-2) for c in 'O{"G/ockn"ku<"itgeq0ujkBiockn0eqo'])
echo -n "Z3JlY28uc2hpQGdtYWlsLmNvbQ==" | base64 -d