Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] MPI_ERR_BUFFER with MPI_SENDRECEV
From: Samuel Richard (samuel.richard_at_[hidden])
Date: 2014-02-19 11:42:13


Hello

In a code written in Fortran, I have a problem with this part :

if (num_node == 0) then

...

else

down_node = num_node-1
! send to down recive from down

 CALL MPI_SENDRECV(tab1(3 :4,:,:), size( tab1(3 :4, : ,:)), &
    & MPI_REAL8, down_node, 101, tab1(1:2, : ,:), size(tab1(1:2, : ,:)), &
    & MPI_REAL8, down_node, 11, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

 CALL MPI_SENDRECV(tab2(3 :4, : ,:), size( tab2(3 : 4, : ,:)), &
    & MPI_REAL8, down_node, 201, tab2(1:2, : ,:), size(tab2(1:2, : ,:)), &
    & MPI_REAL8, down_node, 21, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

endif

if (num_node+1 == max_node) then

...

else

up_node = num_node+1

! send to up recived from up

 CALL MPI_SENDRECV(tab1(n - 3:n - 2, : ,:), size( tab1(n - 3:n - 2, : ,:) ), &
    & MPI_REAL8, up_node, 11, tab1(n - 1:n, : ,:), size(tab1(n - 1:n, : ,:)), &
    & MPI_REAL8, up_node, 101, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

 CALL MPI_SENDRECV(tab2(n - 3:n - 2, : ,:), size( tab2(n - 3:n - 2, : ,:) ), &
    & MPI_REAL8, up_node, 21, tab2(n - 1:n, : ,:), size(tab2(n - 1:n, : ,:)), &
    & MPI_REAL8, up_node, 201, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

endif

I obtain the following error :

[comp104:17175] *** An error occurred in MPI_Sendrecv

[comp104:17175] *** on communicator MPI_COMM_WORLD

[comp104:17175] *** MPI_ERR_BUFFER: invalid buffer pointer

[comp104:17175] *** MPI_ERRORS_ARE_FATAL (goodbye)

and if I change MPI_SENDRECEV by MPI_SEND + MPI_RECEV only for tab1, it works correctly.

if (num_node == 0) then

...

else

down_node = num_node-1
! send to down recive from down

CALL MPI_SEND(tab1(3 :4,:,:), size( tab1(3 :4, : ,:)), &
    & MPI_REAL8, down_node, 101 MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

CALL MPI_RECV(tab1(1:2, : ,:), size(tab1(1:2, : ,:)), &
    & MPI_REAL8, down_node, 11, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

CALL MPI_SENDRECV(tab2(3 :4, : ,:), size( tab2(3 : 4, : ,:)), &
    & MPI_REAL8, down_node, 201, tab2(1:2, : ,:), size(tab2(1:2, : ,:)), &
    & MPI_REAL8, down_node, 21, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

endif

if (num_node+1 == max_node) then

...

else

up_node = num_node+1

! send to up recived from up

 CALL MPI_RECV(tab1(n - 3:n - 2, : ,:), size( tab1(n - 3:n - 2, : ,:) ), &
    & MPI_REAL8, up_node, 11, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

 CALL MPI_SEND(tab1(n - 1:n, : ,:), size(tab1(n - 1:n, : ,:)), &
    & MPI_REAL8, up_node, 101, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

 CALL MPI_SENDRECV(tab2(n - 3:n - 2, : ,:), size( tab2(n - 3:n - 2, : ,:) ), &

    & MPI_REAL8, up_node, 21, tab2(n - 1:n, : ,:), size(tab2(n - 1:n, : ,:)), &
    & MPI_REAL8, up_node, 201, MPI_COMM_WORLD, MPI_STATUS_IGNORE, ierr)

endif

I don't understand why MPI_SENDRECEV works why tab2 but not with tab1, they have the same size.