首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MPI_Type_get_extent中发生错误

MPI_Type_get_extent中发生错误
EN

Stack Overflow用户
提问于 2016-10-14 10:28:01
回答 1查看 147关注 0票数 0

在执行mpirun -n 2 ./out时,无法在下面的代码中获得派生MPI数据类型的扩展。为什么?

错误消息:

代码语言:javascript
复制
*** An error occurred in MPI_Type_get_extent
*** reported by process [969080833,1]
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_ARG: invalid argument of some other kind
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
***    and potentially your MPI job)
1 more process has sent help message help-mpi-errors.txt / mpi_errors_are_fatal
Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

main.cpp:

代码语言:javascript
复制
#include "mpi.h"

MPI_Datatype MPI_A;

struct A
{ 
    int a;
};  

int main()
{   
    MPI_Init(NULL, NULL);

    A a;

    int nblock = 1;
    int block_count = 1;
    MPI_Aint offset = 0;
    MPI_Datatype block_type = MPI_INT;

    MPI_Type_struct(nblock, &block_count, &offset, &block_type, &MPI_A);
    MPI_Type_commit(&MPI_A);

    MPI_Aint extent;
    MPI_Type_get_extent(MPI_A, NULL, &extent);

    return 0;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-14 11:32:51

错误在这里:

代码语言:javascript
复制
MPI_Type_get_extent(MPI_A, NULL, &extent);
                           ^^^^

调用MPI_Type_get_extent中的下限和区段参数都不能是NULL

此外,您的代码缺少了对的强制调用MPI_Finalize()

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40040941

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档