【发布时间】:2011-12-29 17:58:24
【问题描述】:
知道为什么以下内容会给我一个段错误吗?
buf_int = new int[12];
buf_int[0] = stx1.min;
buf_int[1] = stx1.max;
buf_int[2] = stx2.min;
buf_int[3] = stx2.max;
buf_int[4] = sty1.min;
buf_int[6] = sty2.max;
MPI_Bcast(&buf_int, 12, MPI_INT, 0, MPI_COMM_WORLD);
stx1.min = buf_int[0];
如果我注释掉最后一行,我不会得到段错误,但如果我把它留在里面,我会得到 p>
=====================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= EXIT CODE: 11
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
=====================================================================================
错误原来是分段错误。如果不能从给出的代码中推断出错误,我可以包括更多。
buf_int 被声明为
int* buf_int;
【问题讨论】:
-
发布
MPI_Bcast的签名和buf_int的类型。 -
MPI_Bcast 的签名是什么意思?喜欢返回码?
-
我的意思是
MPI_Bcast是如何声明的;参数类型有哪些? -
MPI_Bcast 的参数可以在mpi.deino.net/mpi_functions/MPI_Bcast.html 查看。参数 MPI_INT 和 MPI_COMM_WORLD 是 mpi 标头中的预定义类型。
标签: c++ segmentation-fault mpi