Récemment, je cherchais à compiler et exécuter mon code mpi sur une seule machine (Ubuntu 12.04 - 64 bits Core i7 2670 QM) J'INSTALLÉ mpich2 version 1.2 en utilisant la configuration suivante:erreur de code MPI Fortran sur un seul PC
./configure --prefix=/opt/mpich2 --enable-f77 --enable-fc --enable-cxx --with-device=ch3:sock --with-pm=mpd CC=icc CXX=icpc F77=ifort FC=ifort 2>&1 | tee configure.log
L'installation était correcte, et j'ai obtenu un bon fonctionnement de mpd, j'ai testé mpd avec les exemples et tout est parfait.
Je compile mon code en utilisant mpif77 parce que je ne sais pas pourquoi quand j'ai compilé mpich2 mpif90 n'a pas été créé. Mais même si avec mpif77 j'ai obtenu le code compilé sans erreurs.
Les drapeaux que je utilise pour compiler le code sont:
Pour le compilateur:
LN_FLAGS= -lm -larpack -lsparskit -lfftw3 -lrt -llapack -lblas
Pour linker MPI:
LN_FLAGS_MPI= $(LN_FLAGS) -I$(MPIHOME)/include -L$(MPIHOME) $(MPIHOME)/lib/libmpich.a -lfmpich -lopa -lmpe
Le problème est lorsque je tente de exécuter le code sur ma machine:
D'abord j'appelle mpd en tant que:
mpd &
puis exécutez le code comme:
mpirun -np 4 ./code_mpi
J'ai essayé beaucoup de variations que:
mpiexec -np 4 ./code_mpi
mpirun -n 2 ./code_mpi
mpiexec -n 2 ./code_mpi
Et tous les résultats dans la même erreur:
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
[cli_2]: aborting job:
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
[cli_1]: aborting job:
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
rank 2 in job 1 ubuntu_38132 caused collective abort of all ranks
exit status of rank 2: killed by signal 9
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
[cli_3]: aborting job:
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
[cli_0]: aborting job:
Fatal error in MPI_Comm_rank: Invalid communicator, error stack:
MPI_Comm_rank(106): MPI_Comm_rank(MPI_COMM_NULL, rank=0x14b46a0) failed
MPI_Comm_rank(64).: Null communicator
rank 1 in job 1 ubuntu_38132 caused collective abort of all ranks
exit status of rank 1: return code 1
J'ai passé presque 2 semaines à essayer de résoudre ce problème car j'ai vraiment besoin de faire fonctionner ce code n mon ordinateur personnel pour travailler à la maison. J'apprécie tout ce qui peut m'aider!
Voici comment j'initialiser la bibliothèque MPI
subroutine init()
integer :: provided
call mpi_init(mpi_err)
call mpi_comm_rank(mpi_comm_world,rank,mpi_err)
call mpi_comm_size(mpi_comm_world,an_proc,mpi_err)
call MPI_BARRIER(MPI_COMM_WORLD,mpi_err)
end subroutine init
Vous ne devez pas démarrer MPD en premier; et pouvez-vous compiler/exécuter un simple MPI "Hello world" avec succès, par exemple http://www.slac.stanford.edu/comp/unix/farm/mpi.html? –
Montrez-nous cette partie du code où vous initialisez la bibliothèque MPI, par ex. la partie contenant les appels à 'MPI_INIT' et à' MPI_COMM_RANK'. –