c - Is MPI_COMM_WORLD not constant?
问题描述
I read here, that
While MPI_Comm_split is the most common communicator creation function, there are many others. MPI_Comm_dup is the most basic and creates a duplicate of a communicator. It may seem odd that there would exist a function that only creates a copy, but this is very useful for applications which use libraries to perform specialized functions, such as mathematical libraries. In these kinds of applications, it’s important that user codes and library codes do not interfere with each other. To avoid this, the first thing every application should do is to create a duplicate of MPI_COMM_WORLD, which will avoid the problem of other libraries also using MPI_COMM_WORLD. The libraries themselves should also make duplicates of MPI_COMM_WORLD to avoid the same problem.
Can MPI_COMM_WORLD be changed after the start of the initialisation of MPI? Is MPI_COMM_WORLD not constant?
解决方案
理由MPI_Comm_dup(MPI_COMM_WORLD, ...)
是您不希望 MPI 应用程序 (in MPI_COMM_WORLD
) 发送的消息被底层库接收。相反,您不希望 MPI 应用程序接收库发送的消息。
避免这种情况的一种简单方法是为库使用专用的通信器,而复制MPI_COMM_WORLD
是实现这一目标的最简单方法。
您的问题的答案是MPI_COMM_WORLD
之后无法更改MPI_Init()
。更一般地说,通信器一旦创建就不能更改。
推荐阅读
- c++ - Allegro5 al_create_display() 在 Mac OS Catalina 上崩溃
- html - HTML DropDown 按钮内容卡在导航栏中
- r-exams - 为什么 R 包考试的 nops_scan 函数不创建 zip 文件?
- haskell - Haskell:为什么模式匹配即使编译和执行也不是详尽无遗的?
- java - JVM和OS解释器之间的区别?
- php - 如何将帖子数据传递到另一个视图
- r - 按两个变量分组时,data.table 中的下标超出边界
- javascript - Javascript在循环内添加自定义活动类
- opencv - 如何在 Visual Studio 2019 上的 Windows 10 中安装带有 contrib 模块的 OpenCV
- javascript - 将嵌套的对象数组过滤为对象数组