Thanks for replying, but the difference between what can be done in C vs fortran is still my problem. I apologize for my rudimentary understanding of C, but here is a brief summary:

In my originally attached C-program 'testmpi3.c' we have:

  int **shar_pntr : declare pointer variable (a pointer to a pointer?)

                               |
                               |

 MPI_Win_shared_query (win, maps_shm[j], &sz, &dsp_unit, &shar_pntr[j]);
On each rank this call returns an address in 'shar_pntr' for each 'j' index the addresses are in shared memory on the node, but from the address space of another process

                               |
                               |

 halo[j] = shar_pntr[j][0];
This assignment statement stores in 'halo[j]' the variable at the 'shar_pntr[j][0]' address, which is what we want

----------------------------------------------------------------------------------------------------------

In my originally attached fortran program 'testmpi3.f90' we have:


integer(kind=MPI_ADDRESS_KIND),dimension(:),allocatable :: shar_pntr

                                |
                                |

      allocate(shar_pntr(0:1))

                                |
                                |

call mpi_win_shared_query(iwin,maps_shm(j),isizew,idisp,shar_pntr(j),ierr)
On each rank this call also returns an address in 'shar_pntr' for each 'j' index as above, the addresses are in shared memory on the node, but from the address space of another process

                                |
                                |

 halo(j)= shar_pntr(j)
This assignment statement stores in 'halo(j)' what is in 'shar_pntr(j)', the address! That's what fortran should do, but it isn't what is needed here

------------------------------------------------------------------------------------------------

So, how can 'testmpi3.f90' be changed to do what 'testmpi3.c' does?

T. Rosmond






On 04/22/2016 09:12 AM, Dave Love wrote:
Jeff Hammond <jeff.scie...@gmail.com> writes:

MPI uses void** arguments to pass pointer by reference so it can be
updated. In Fortran, you always pass by reference so you don't need
this.
I don't know if it's relevant in this case, but that's not generally
true (even for Fortran 77, for which I used to know the standard
more-or-less by heart).  It definitely isn't true for gfortran, and I'm
confident not for the Intel compiler, or it would miss optimizations.
You may get away with assuming call-by-reference, but you're likely to
get bitten if you don't obey the argument association rules.
_______________________________________________
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/04/28996.php

Reply via email to