+1 If you're starting new code, try using the F08 MPI bindings. Type safety === good.
> On Jan 22, 2016, at 10:44 AM, Jeff Hammond <jeff.scie...@gmail.com> wrote: > > You will find the MPI Fortran 2008 bindings to be significantly better w.r.t. > MPI types. See e.g. MPI 3.1 section 17.2.5 where it describes > TYPE(MPI_Status), which means that the status object is a first-class type in > the Fortran 2008 interface, rather than being an error prone INTEGER array. > > I haven't used Fortran 2008 bindings in a nontrivial way yet, but it is my > understanding that Open-MPI has a good implementation of them and has for a > relatively long time. > > For multilingual MPI programmers, the Fortran 2008 bindings will be quite > easy to understand from the perspective of the C bindings, since they are > quite similar in many respects. > > Jeff > > On Fri, Jan 22, 2016 at 7:12 AM, Paweł Jarzębski <pj...@ippt.pan.pl> wrote: > Thx a lot. I will be more careful with declaration of the MPI variables. > > Pawel J. > > W dniu 2016-01-22 o 16:06, Nick Papior pisze: >> The status field should be >> >> integer :: stat(MPI_STATUS_SIZE) >> >> Perhaps n is located stackwise just after the stat variable, which then >> overwrites it. >> >> 2016-01-22 15:37 GMT+01:00 Paweł Jarzębski <pj...@ippt.pan.pl>: >> Hi, >> >> I wrote this code: >> >> program hello >> implicit none >> >> include 'mpif.h' >> integer :: rank, dest, source, tag, ierr, stat >> integer :: n >> integer :: taskinfo, ptr >> >> call MPI_INIT(ierr) >> call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr) >> >> if(rank.eq.0) then >> write(*,*) 'Hello' >> >> n = 20 >> dest = 1 >> tag = 1 >> taskinfo = n >> call MPI_SEND(taskinfo, 1, MPI_INTEGER, dest, tag, >> 1 MPI_COMM_WORLD, ierr) >> >> tag = tag + 1 >> call MPI_SEND(ptr, 1, MPI_INTEGER, dest, tag, >> 1 MPI_COMM_WORLD, ierr) >> >> else >> source = 0 >> tag = 1 >> >> ! n = 1 >> call MPI_RECV(taskinfo, 1, MPI_INTEGER, source, tag, >> 1 MPI_COMM_WORLD, stat, ierr) >> >> n = taskinfo >> >> tag = tag + 1 >> >> write(*,*) 'n1 ', n >> write(*,*) 'taskinfo1 ', taskinfo >> call MPI_RECV(ptr, 1, MPI_INTEGER, source, tag, >> 1 MPI_COMM_WORLD, stat, ierr) >> write(*,*) 'n2 ', n >> write(*,*) 'taskinfo2 ', taskinfo >> endif >> >> call MPI_FINALIZE(ierr) >> end >> >> >> I supposed that it should produce this: >> Hello >> n1 20 >> taskinfo1 20 >> n2 20 >> taskinfo2 20 >> >> But in fact it produces this: >> Hello >> n1 20 >> taskinfo1 20 >> n2 2 >> taskinfo2 20 >> >> It's strange to me that variable "n" is changed after call to MPI >> subroutine, but I dont even put it in calls to MPI. >> If I comment line 13 with " write(*,*) 'Hello' " everything is ok. If I >> uncomment line 30 with "n = 1", everything is ok as well. >> >> Could anybody explain me what is happening? >> >> I tested it on: >> 1) intel fortran compiler 14.0 and openmpi 1.6.5 >> 1) intel fortran compiler 13.1.3 and openmpi 1.8.4 >> >> Best regards, >> Pawel J. >> >> >> >> >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >> Link to this post: >> http://www.open-mpi.org/community/lists/users/2016/01/28334.php >> >> >> >> -- >> Kind regards Nick >> >> >> _______________________________________________ >> users mailing list >> >> us...@open-mpi.org >> >> Subscription: >> http://www.open-mpi.org/mailman/listinfo.cgi/users >> >> Link to this post: >> http://www.open-mpi.org/community/lists/users/2016/01/28336.php > > > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2016/01/28337.php > > > > -- > Jeff Hammond > jeff.scie...@gmail.com > http://jeffhammond.github.io/ > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2016/01/28338.php -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/