# Open MPI User's Mailing List Archives

 |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list
 Subject: Re: [OMPI users] try to understand heat equation 2D mpi version From: Eugene Loh (eugene.loh_at_[hidden]) Date: 2010-10-22 02:00:50 Next message: 邵思睿: "[OMPI users] Some problems" Previous message: christophe petit: "[OMPI users] try to understand heat equation 2D mpi version" In reply to: christophe petit: "[OMPI users] try to understand heat equation 2D mpi version" christophe petit wrote: > i'm studying the parallelized version of a solving 2D heat equation > code in order to understand cartesian topology and the famous > "MPI_CART_SHIFT". > Here's my problem at this part of the code : > > > ------------------------------------------------------------------------------------------------------------------------------------------- > call MPI_INIT(infompi) > comm = MPI_COMM_WORLD > call MPI_COMM_SIZE(comm,nproc,infompi) > call MPI_COMM_RANK(comm,me,infompi) > ! > > ...... > > > ! Create 2D cartesian grid > periods(:) = .false. > > ndims = 2 > dims(1)=x_domains > dims(2)=y_domains > CALL MPI_CART_CREATE(MPI_COMM_WORLD, ndims, dims, periods, & > reorganisation,comm2d,infompi) > ! > ! Identify neighbors > ! > NeighBor(:) = MPI_PROC_NULL > ! Left/West and right/Est neigbors > CALL MPI_CART_SHIFT(comm2d,0,1,NeighBor(W),NeighBor(E),infompi) > > print *,'rank=', me > print *, 'here first mpi_cart_shift : neighbor(w)=',NeighBor(W) > print *, 'here first mpi_cart_shift : neighbor(e)=',NeighBor(E) > > ... > > ------------------------------------------------------------------------------------------------------------------------------------------- > > with x_domains=y_domains=2 > > and i get at the execution :" mpirun -np 4 ./explicitPar" > > rank= 0 > here first mpi_cart_shift : neighbor(w)= -1 > here first mpi_cart_shift : neighbor(e)= 2 > rank= 3 > here first mpi_cart_shift : neighbor(w)= 1 > here first mpi_cart_shift : neighbor(e)= -1 > rank= 2 > here first mpi_cart_shift : neighbor(w)= 0 > here first mpi_cart_shift : neighbor(e)= -1 > rank= 1 > here first mpi_cart_shift : neighbor(w)= -1 > here first mpi_cart_shift : neighbor(e)= 3 > > I saw that if the rank is out of the topology and wihtout periodicity, > the rank should be equal to MPI_UNDEFINED whis is assigned to -32766 > in "mpif.h" . So, why have i got the value "-1" ? > On my Macbook pro, i get the value "-2". It seems to me the man page says MPI_PROC_NULL may be returned, and in OMPI that looks like -2. Can you try the following: % cat x.f90   include "mpif.h"   integer comm, dims(2)   logical periods(2)   call MPI_INIT(ier)   ndims = 2   dims(1)=2; periods(1) = .false.   dims(2)=2; periods(2) = .false.   CALL MPI_CART_CREATE(MPI_COMM_WORLD, ndims, dims, periods, .false., comm, ier)   CALL MPI_CART_SHIFT(comm, 0, 1, iwest, ieast, ier)   write(6,*) iwest, ieast, MPI_PROC_NULL   call MPI_Finalize(ier) end % mpif90 x.f90 % mpirun -n 4 ./a.out  1 -2 -2  -2 2 -2  -2 3 -2  0 -2 -2 Next message: 邵思睿: "[OMPI users] Some problems" Previous message: christophe petit: "[OMPI users] try to understand heat equation 2D mpi version" In reply to: christophe petit: "[OMPI users] try to understand heat equation 2D mpi version"