在32位和64位处理器上运行混合的mpi可执行文件
Running mixed mpi executables on 32 bit and 64 bit processors
我正在尝试使用下面的教程使用ubuntu 14.04和beagleboard xm板制作一个mpi集群。问题是我的客户是beagleboard xm,它有一个32位armv7处理器。我使用mpic++-o hello_world.c创建了一个可执行文件,其内容是:
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
// Initialize the MPI environment
MPI_Init(NULL, NULL);
// Get the number of processes
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
// Get the rank of the process
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
// Get the name of the processor
char processor_name[MPI_MAX_PROCESSOR_NAME];
int name_len;
MPI_Get_processor_name(processor_name, &name_len);
// Print off a hello world message
printf("Hello world from processor %s, rank %d"
" out of %d processorsn",
processor_name, world_rank, world_size);
// Finalize the MPI environment.
MPI_Finalize();
}
我可以在ubuntu 14.04(intel x86_64)和beagleboard xm上编译它。然而,当我尝试并行运行时,例如使用"mpirun -host Server,board1 ./mpi_hello_world
",我会得到
bash: orted: command not found
--------------------------------------------------------------------------
A daemon (pid 8349) died unexpectedly with status 127 while attempting
to launch so we are aborting.
我相信这是因为32位可执行程序无法从我的服务器启动。如果我在主板上运行"./mpi_hello_world",我会得到"-su: ./mpi_hello_world: cannot execute binary file: Exec format error
"。如果我在板上编译并尝试在服务器上运行,则会发生相反的情况。所以我的问题是,我如何才能有一个可执行文件同时在我的服务器和主板上运行?
orted
。您应该修改Beagle板上shell概要文件脚本中的PATH
变量,使其包含Open MPI安装的bin
目录的路径,并修改LD_LIBRARY_PATH
变量,使之包含Open MPI的lib
目录的路径。或者使用--prefix
选项提供远程安装的路径:
mpiexec --prefix /path/to/openmpi/on/beagle ...
Prefix在远程系统上同时设置PATH
和LD_LIBRARY_PATH
。请注意,库路径的最后一个组件是从本地安装中复制的,例如,如果Open MPI的库位于/path/to/openmpi/lib64
(因为您的主机是64位的),那么它会将远程主机上的LD_LIBRARY_PATH
设置为/path/to/openmpi/on/beagle/lib64
,这可能是不正确的。只有当Open MPI安装在默认的系统库位置时,例如从软件包中安装时,以及仅在某些Linux发行版上,尤其是基于RedHat的发行版上时,这通常才会引起关注。Ubuntu遵循Debian惯例,将64位库放在/usr/lib
中,因此您应该仍然能够安全地使用--prefix
机制。
由于您希望在具有不同CPU类型的主机上运行程序,因此必须在具有--enable-heterogeneous
的两个系统上重新构建Open MPI,以便支持异构计算。请确保您没有使用--enable-orterun-prefix-by-default
进行构建,因为这需要将Open MPI安装在主机和Beagle板上完全相同的位置。
如果两个平台上的可执行文件不共享一个公共文件系统,则不需要为它们指定不同的名称,但这样做有助于防止混淆。
总结:
mpiexec --prefix /path/to/openmpi/on/beagle
-H localhost -n 1 ./binary_x64 :
-H bealgexm -n 1 ./binary_arm
这仍然假设主机上的当前目录,例如/home/user/mpitest
也存在于Beagle板上。如果没有,请在第二个应用程序上下文中提供ARM可执行文件的完整路径。
注意:Open MPI中的异构支持通常已中断。只有非常简单的代码才可能工作。
- 用MacOS Mojave编译C++:致命错误:mpi.h:没有这样的文件或目录
- 混合组合和继承的C++问题
- 在混合代码库中将C转换为C++时出现许多包含错误
- MPI突然停止了对多个核心的操作
- D3D11-将混合权重和索引传递到顶点着色器
- 设置 Visual Studio for MPI: 找不到标识符错误
- 使用 make 编译 MPI,几个命名空间错误,例如"错误:未知类型名称'使用'?
- 如何使用 MPI 的远程内存访问 (RMA) 功能并行化数据聚合?
- 重载 MPI 中的运算符 ()
- C++分数混合比较运算符错误
- MPI:检查是否有任何进程已终止
- 是否可以混合使用SFINAE和模板专业化?
- 如何在 Python C++ 混合库中调试非确定性分段错误?
- 使用 Boost.Spirit 解析具有混合数据类型的 OBJ 文件?
- 使用 pybind11 共享 MPI 通信器
- 使用 CMake,Microsoft MPI 和 Visual Studio 2017 找不到 mpi.h
- 混合开放MP/MPI代码中的多线程发送/接收时出错
- 在32位和64位处理器上运行混合的mpi可执行文件
- 如何使用MPI混合串行和并行代码
- 编译一个混合GNU Fortran/ c++ MPI共享库