user7671105 user7671105 - 10 months ago 43
C Question


How is

stored in the memory?

I wanna send a column using
and i think it's better to define new type using

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download