c++ - openMPI 数据类型可移植性

标签 c++ c mpi openmpi

FAQ #20说:

As of v1.1, Open MPI requires that the size of C, C++, and Fortran datatypes be the same on all platforms within a single parallel application with the exception of types represented by MPI_BOOL and MPI_LOGICAL -- size differences in these types between processes are properly handled. Endian differences between processes in a single MPI job are properly and automatically handled.

Prior to v1.1, Open MPI did not include any support for data size or endian heterogeneity.

这是否意味着 MPI_UNSIGNED_LONG 在所有主机上都必须是 32 位或在所有主机上都必须是 64 位?我的集群由 32 位和 64 位 Linux 服务器组成。确保 longunsigned long 在所有主机上具有相同大小的最佳方法是什么?也许我应该只使用 int 和 'long long' ?在所有主机上它们分别是 32 位和 64 位。数据大小不一致只要不使用就可以吗?

谢谢。

最佳答案

无论架构如何,OpenMPI 数据类型都应该相同。例如,MPI_UNSIGNED_LONG 被定义为 32 位,MPI_UNSIGNED_LONG_LONG 被定义为 64 位(例如,参见此处:http://www.mpi-forum.org/docs/mpi-2.2/mpi22-report.pdf,第 433 页。MPI_UNSIGNED_LONG 被定义为具有 4 个字节)。

MPI 规范另外还有 MPI_INT64_T 和 friend ,因此无需猜测。

关于c++ - openMPI 数据类型可移植性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7165071/

相关文章:

c - 向前和向后高斯消除 - 并行化?

c++ - MPI 中的简单聊天程序 C++

函数 pthread_join 的代码 - Pthread 库

c - 处理来自 execvp() 的错误

c++ - 在 SQLAPI c++ 中向 IN 子句添加多个参数

c++ - () 运算符在左侧 C++ 重载

c - 如何处理 "warning: ignoring return value of ‘system’ , "

C MPI - 自动化多次运行并保存日志和信息的最佳方式。 + 预定义的全局变量

C++函数重载(函数多态)

c++ - 为什么探查器需要管理权限(在 Windows 上)