MPI error

I use PGI worktation 2010, centos X64. I compile the example in /opt/pgi/linux86-64/10.3/EXAMPLES/MPI/mpihello, then type

 mpirun -np 3 mpihello
 Hello world!  I'm node           0
 Hello world!  I'm node           0
 Hello world!  I'm node           0

what’s wrong with it? if you compile it with mpif90, the result is right. [/code]

Hi siwuxie,

How did you compile the version with the wrong answer? Which MPI version are you using?

  • Mat

I use the command line

 pgfortran mpihello.f -Mmpi=mpich1 -o mpihello

According to the user’s guide, compiler will use mpich1 installed in pgi’s folder.
And if you compile it with mpif90 of MPICH2

mpif90 -o mpihello mpihello.f
 mpirun -n 3 mpihello
 Hello world!  I'm node           0
 Hello world!  I'm node           2
 Hello world!  I'm node           1

So mpirun can get right result, and this may not be the problem of SSH. I’ve installed PGI again, but still can’t get right anwser. [/code]

Hello,

Try this version of mpihello.f

% more mpihello.f
program hello
include ‘mpif.h’
integer ierr, myproc,hostnm, nprocs
character*64 hostname
call mpi_init(ierr)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)
call mpi_comm_rank(MPI_COMM_WORLD, myproc, ierr)
ierr=setvbuf3f(6,2,0)
ierr=hostnm(hostname)
write(6,100) myproc,nprocs,hostname
100 format(1x,“hello - I am process”,i3," of", i3, " on host ",A32)
call mpi_finalize(ierr)
end

I am assuming you have release 10.3 installed and you said ‘yes’
to MPICH install in /opt/pgi


% pgfortran -o mpihello mpihello.f -Mmpi=mpich1
%/opt/pgi/linux86/10.3/mpi/mpich/bin/mpirun -np 4 mpihello

to make sure you are using the mpich1 version of mpirun.

dave