Quantcast
Channel: Clusters and HPC Technology
Viewing all articles
Browse latest Browse all 930

Strange behaviour of Fortran MPI_Waitany under MPS analysis

$
0
0

It seems that the MPI Performance Snapshot analysis interferes with the execution of the Fortran programs, i.e. the following code

PROGRAM main
    USE MPI
    USE ISO_FORTRAN_ENV

    IMPLICIT NONE

    INTEGER(kind=int32), PARAMETER :: length = 10

    INTEGER(kind=int32) :: numprocs, myid, ierr, i, tag, offset, idx

    INTEGER(kind=int32), ALLOCATABLE :: requests(:)
    REAL(kind=real32), ALLOCATABLE :: buffer(:)

    CALL MPI_Init(ierr)

    CALL MPI_Comm_size(MPI_COMM_WORLD, numprocs, ierr)
    CALL MPI_Comm_rank(MPI_COMM_WORLD, myid, ierr)

    IF (numprocs == 1) THEN
        write(*,*) "This example need at least two processes."
        CALL MPI_Finalize(ierr)
        STOP
    END IF

    ! Allocate memory for send/recv buffer and request array
    ALLOCATE(buffer(numprocs*length))
    ALLOCATE(requests(numprocs))

    ! All workers (rank 1..numprocs-1) send a message to rank 0
    IF (myid > 0) THEN
        DO i=1,length
            buffer(i) = sin(real(i))
        END DO

        tag = myid
        CALL MPI_Isend(buffer, length, MPI_REAL, 0, tag, MPI_COMM_WORLD, requests(1), ierr)
        CALL MPI_Wait(requests(1), MPI_STATUS_IGNORE, ierr)

    ! Rank 0 receive these messages
    ELSE
        offset = 0
        DO i=1,numprocs-1
            tag = i
            CALL MPI_Irecv(buffer(offset+1), length, MPI_REAL, i, tag, &
                MPI_COMM_WORLD, requests(i), ierr)
            offset = offset + length
        END DO

        DO WHILE(.TRUE.)
            CALL MPI_Waitany(numprocs-1, requests, idx, MPI_STATUS_IGNORE, ierr)
            IF (idx /= MPI_UNDEFINED) THEN
                write(*,*) "Recieved message with idx =", idx
            ELSE
                EXIT
            END IF
        END DO
    END IF

    CALL MPI_Finalize(ierr)
END PROGRAM MAIN

prints different results with and without the MPS analysis. Without MPS analysis the output is the row of number from 1 to 15 (as expected). But running the same program under -mps flag outputs numbers starting from 0, i.e. from 0 to 14.

I use MPS version which comes from ITAC 9.1 The binary is produced using Intel Fortran compiler 15.0.5 and Intel MPI Library 5.1


Viewing all articles
Browse latest Browse all 930

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>