【问题标题】:mpi in c how to extends the use of MPI_Type_create_subarray?c中的mpi如何扩展使用MPI_Type_create_subarray?
【发布时间】:2019-11-08 12:26:40
【问题描述】:

如何使用 MPI_Type_create_subarray 来传递字符数组,但类型非常大,类型为 unsigned long long int 总行数 (total_nrows) = 31,613,582,882,每个行列 (real_rows3) 写入的行数约为 2,580,689,006,以防使用 14 个行列。

unsigned long long int globalsizes[2] = {total_nrows, 365};
unsigned long long int localsizes [2] = {real_rows3, 365};
unsigned long long int starts[2]      = {startrow, 0};
MPI_Datatype localarray;

 MPI_Type_create_subarray(2, globalsizes, localsizes, starts, MPI_ORDER_C, MPI_CHAR, &localarray);

【问题讨论】:

    标签: c mpi large-data hpc


    【解决方案1】:

    长话短说,你不能。

    来自 MPI 标准:

    int MPI_Type_create_subarray(int ndims,
                               const int array_of_sizes[],
                               const int array_of_subsizes[],
                               const int array_of_starts[],
                               int order,
                               MPI_Datatype oldtype,
                               MPI_Datatype *newtype)
    

    参数为int,因此存在2^31-1 的内在限制。

    话虽如此,您也许可以通过使用中间(和更大)数据类型来获得类似的结果。 例如,2^32 MPI_CHAR 的数组可以看作是2^10 MPI_CHAR2^22 向量数组。这显然不适用于任何数字,但这可能会对您有所帮助。

    另一种选择是使用BigMPI

    基本上,int(32 位)被替换为MPI_Count(64 位)。 请记住,BigMPI 不是 MPI 3.1 标准的一部分,因此如果您必须编写可移植代码,这不是一个选择。

    [编辑]

    BigMPI 有可能进入 MPI 标准,并可能与 MPI 4.0 一起使用。

    【讨论】:

    • BigMPI 不是 MPI-3 的一部分,但据我所知,它严格符合 MPI-3 和 ISO C99,因此它应该非常便携(它很可能受到 MPI 实现的限制不是内部计数安全的)。我使用 MIT 许可证是因为我让每个人都能使用它或从中复制而不受惩罚。
    • 另外,你应该说它不在 MPI 3.1 标准中,因为它似乎有机会进入 4.0 ?
    猜你喜欢
    • 2012-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-14
    • 2013-10-29
    • 2016-01-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多