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

SENDRECV + MPI_TYPE_CREATE_STRUCT

$
0
0

Dear all,

I have some basic question about MPI about  SENDRECV and MPI_TYPE_CREATE_STRUCT.

First: MPI_TYPE_CREATE_STRUCT. As suggested by James Tullos, whem I have a data type as:

type particle
 integer                 :: rx
 integer                 :: ry
 real                    :: QQ(4)
end type particle

I can create a MPI data type as follows:

type(particle) dummy ! Used for calculation of displacement
integer lengths(2), types(2), ierr
integer(kind=MPI_ADDRESS_KIND) displacements
integer mpi_particle_type
types(1)=MPI_INTEGER
types(2)=MPI_REAL
lengths(1)=2
lengths(2)=4
displacements(1)=0
displacements(2)=sizeof(dummy%rx)+sizeof(dummy%ry)
call MPI_TYPE_CREATE_STRUCT(2,lengths,displacements,types,mpi_particle_type,ierr)
call MPI_TYPE_COMMIT(mpi_particle_type,ierr)

the question is: why Do I use INTEGER MPI_PARTICLE _TYPE and not REAL MPI_PARTICLE_TYPE.

The second question is: How can I send for example 100 MPI_PARTICLE _TYPE varibles to another processor with SENDRECV. Do I have to create a vector MPI_PARTICLE _TYPE:

MPI_PARTICLE _TYPE :: VECTOR(100)

Am I right?

Really thanks to everyone. 

Diego


Viewing all articles
Browse latest Browse all 930

Trending Articles



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