【发布时间】:2013-12-02 13:33:51
【问题描述】:
我正在为 MPI 创建新的派生数据类型,以从 Counter 结构发送数据,您知道在 MPI 中创建新类型是痛苦和棘手的,因为如果我走在正确的轨道上,我需要一些帮助,谢谢?
typedef struct Counter{
int range1,range2,range3,range4;
double preset1 ,preset2 ,preset3 ,preset4;
} countType;
MPI_Datatype createRecType()
{
// Set-up the arguments for the type constructor
MPI_Datatype new_type;
int count = 2;
int blocklens[] = { 4, 4 };
MPI_Aint indices[4];
indices[0] = 0;
MPI_Type_extent( MPI_DOUBLE, &indices[1] );
indices[1] *= 4; // There are 2 doubles
MPI_Datatype old_types[] = { MPI_INT ,MPI_DOUBLE};
// Call the data type constructor
MPI_Type_struct(count, blocklens, indices, old_types, &new_type);
MPI_Type_commit(&new_type);
return new_type;
}
【问题讨论】:
-
什么是
drive datatype?我对 MPI 知之甚少,但我无法将其与任何东西相匹配.. 你的意思是derived datatype,即具有多个字段的结构将充当缓冲区的“项目”? -
如果您的意思是“衍生”,请更正您的问题和主题。 “驱动器”具有误导性。我没有更正,因为我不确定你的意思。
标签: c++ c struct mpi cluster-computing