user7671105 user7671105 - 7 months ago 31
C Question

MPI_TYPE_CREATE_HVECTOR

How is

MPI_Type_create-hvector
stored in the memory?

I wanna send a column using
MPI_Send
and i think it's better to define new type using
MPI_Type_create-hvector
!!!!

but i don't know it's a good way or not, and how?

denote that i wrote a c program.

Answer Source

Taken from the OpenMPI documentation:

int MPI_Type_create_hvector(int count, int blocklength,
    MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype)

It's not very clear from your question what exactly you are trying to do. Note that when you create this datatype, you decide exactly how your vector is stored in memory.

So if you have a contiguous chunk of doubles that are accessed in a row-major 2D-esque manner (i.e. data[iCol+N_COLS*iRow]), then you can create a "column" datatype in the following manner.

MPI_Datatype mpiColumn;
int info = MPI_Type_create_hvector(N_ROWS, 1, sizeof(double)*N_COLS, MPI_DOUBLE, &mpiColumn);