Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
29 Views

MPI_Gather equivalent in coarray Fortran

Is there an equivalent of mpi_gather in coarray Fortran syntax? I know that it is possible to loop over all images to gather all values on all images. would be nice if the coarray objects could be called as coarray segments like:

real :: num
  • real, allocatable :: NumVec(:) allocate( NumVec( num_images() ) ) NumVec = num[ 1 : num_images() ]
  •  

    0 Kudos
    3 Replies
    Highlighted
    New Contributor II
    29 Views

    To further bring attention to this question, why was coarray slicing, as exemplified in the above, chosen to be illegal in the Fortran standard? It seems to me that it would have been neat concise substitute for such MPI functionalities as mpi_gather().

    0 Kudos
    Highlighted
    Valued Contributor III
    29 Views

    A.King wrote:

    .. would be nice if the coarray objects could be called as coarray segments like

    NumVec = num[ 1 : num_images() ]
    

    I think the following is allowed by the standard, too bad Intel Fortran runs into an ICE with it:

    NumVec = [( num, i=1, num_images() )]

     

    0 Kudos
    Highlighted
    New Contributor II
    29 Views

    Hi FortranFan, thanks for the response. That is the solution I am using right now, but compared to a mpi_gather implementation in our code, I see that I am getting a performance hit in the Coarray implementation of the software, which is roughly equal to a factor of num_images(). Of course, the code is more complex. I will have to isolate this segment of the code to see if that's at the root of the performance hit in Coarray implementation compared to the MPI version.

    But still, I am not convinced why the Fortran committee considered coarray slicing illegal: NumVec = num[ 1 : num_images() ]

    0 Kudos