【发布时间】:2018-03-12 12:04:29
【问题描述】:
从std::thread 调用MPI_Init 是否安全?
int main(int argc, char** argv) {
std::thread mpi_thread([...](){
MPI_Init(...);
// All MPI calls are done by this thread.
MPI_Finalize();
});
// The main thread is doing different stuff
mpi_thread.join();
return 0;
}
【问题讨论】:
-
我看不出有什么问题,但我想知道这样做的目的是什么。
-
您可能还想使用Boost.MPI 以获得更好的界面。
-
我暂时是这样,但
Boost.MPI有自己的一系列问题。很多时候,您必须回退到 MPI 文档才能猜测发生了什么。