Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] MPI_Gatherv error
From: Zhangping Wei (zhangping_wei_at_[hidden])
Date: 2011-04-21 22:19:10

Dear all, I am a beginner of MPI, right now I try to use MPI_GATHERV in my code, the test code just gather the value of array A to store them in array B, but I found an error listed as follows, 'Fatal error in MPI_Gatherv: Invalid count, error stack: PMPI_Gatherv<398>: MPI_Gatherv failed <sbuf=004d96c0, scount=64,MPI_REAL, rbuf=0049AC0, rcnts=003DCB8, displs=003D4C68, MPI_REAL, root=0, MPI_COMM_WORLD> failed PMPI_Gatherv<317>: Negative count, value is -842150451’ Here I post my program with the email, I wonder anyone can help me to fix it or not? I guess my error is from the sending or receiving buffer and the displacement of the value stored, I tried to changed ‘B,jlen,idisp’ to ’ B(1,1), jlen(myid),idisp(myid)’ or other things, but I still cannot work it out. I am looking forward some help from you. Zhangping Wei   my code is,       PROGRAM MAIN       IMPLICIT NONE       INCLUDE 'mpif.h'       INTEGER I,J,IWORK,JWORK,I1,I2,J1,J2       REAL A(16,16),B(16,16)       INTEGER,ALLOCATABLE ::idisp(:),jlen(:)       integer myid,numprocs,rc,ierr,istar,iend,jstar,jend       integer status(MPI_STATUS_SIZE)       CALL MPI_INIT(ierr)       CALL MPI_COMM_RANK(MPI_COMM_WORLD,myid,ierr)       CALL MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,ierr)  !     PRINT *,'process ',myid, 'of',numprocs, 'is alive.'         allocate(idisp(0:numprocs-1),jlen(0:numprocs-1))            DO J=1,16         DO I=1,16             A(I,J)=I+J             B(I,J)=0.0         ENDDO       ENDDO           I1=1;I2=16;J1=1;J2=16             JWORK=(J2-J1)/numprocs+1             JSTAR=MIN(myid*JWORK+J1,J2+1)             JEND=MIN(JSTAR+JWORK-1,J2)             ISTAR=I1             IEND=I2                              PRINT *,myid,istar,iend,jstar,jend       jlen(myid)=16*(jend-jstar+1)       idisp(myid)=16*(jstar-1)       print *,myid,jlen(myid),idisp(myid)           CALL MPI_GATHERV(A(1,jstar),jlen(myid),MPI_REAL,      *B,jlen,idisp,MPI_REAL,0,MPI_COMM_WORLD,IERR)       IF(myid.EQ.0)THEN         DO J=1,16             DO I=1,16                 PRINT *,I,J,B(I,J)             ENDDO         ENDDO            ENDIF       CALL MPI_Finalize(rc)                                               END PROGRAM