Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

MPI_Gather equivalent in coarray Fortran

DataScientist
Valued Contributor I
585 Views

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
    DataScientist
    Valued Contributor I
    585 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
    FortranFan
    Honored Contributor II
    585 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
    DataScientist
    Valued Contributor I
    585 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
    Reply