Hi Diego, I don't know what CPU/compiler you are using and what -r8 option means, but DISPLACEMENTS(2) and DISPLACEMENTS(3) is incorrect if integer is 4 bytes and real is 8 bytes. In this case, usually there is a gap between ip and RP. See description about datatype alignment in the MPI Standard.
Regards, Takahiro > Dear all. > I have some problem with MPI_TYPE_CREATE_STRUCT and as a consequence > with SENDRECV. > > I have this variable type > > *type particle* > *integer :: ip* > * real :: RP(2)* > * real :: QQ(4)* > *end type particle* > > When I compile in double precision with: > > *mpif90 -r8 -fpp -DPARALLEL *.f90 * > > So when I create my own variable type for MPI, I have > > > *TYPES(1)=MPI_INTEGER !We have three variables > type in the new varible* > *TYPES(2)=MPI_DOUBLE_PRECISION !Integer and Real and Real* > * TYPES(3)=MPI_DOUBLE_PRECISION !Integer and Real and Real* > * nBLOCKS(1)=1 !number of > element in each block * > * nBLOCKS(2)=2* > * nBLOCKS(3)=4* > * !* > * DISPLACEMENTS(1)=0* > * DISPLACEMENTS(2)=sizeof(dummy%ip)* > * > DISPLACEMENTS(3)=sizeof(dummy%ip)+sizeof(dummy%RP(1))+sizeof(dummy%RP(2))* > * ! * > * CALL > MPI_TYPE_CREATE_STRUCT(3,nBLOCKS,DISPLACEMENTS,TYPES,MPI_PARTICLE_TYPE, > PI%ierr)* > * CALL MPI_TYPE_COMMIT(MPI_PARTICLE_TYPE,MPI%ierr)* > > > Am I right? > Thanks, in advance, for any kind of help