MPI, C, derived types, struct of vectors?

前端 未结 2 1555
温柔的废话
温柔的废话 2021-01-15 05:05

I need to create an MPI derived type to represent a class in my program. The class is fairly straight forward, but large (about 75 data members**). All the data members are

2条回答
  •  被撕碎了的回忆
    2021-01-15 05:32

    The easiest way to go is to just treat the whole object as a big buffer:

    MPI_Datatype datatype;
    
    MPI_Type_contiguous(sizeof(RestartData), MPI_BYTE, &datatype);
    MPI_Type_commit(&datatype);
    

    I don't see the benefit of telling MPI about the internal structure of your class.

    Alternatively a 2D array is an array of 1D arrays. So (I imagine) you could use one call to MPI_Type_contiguous per array dimension to build up the array datatype.

提交回复
热议问题