MPICH 是否支持跨平台执行?

Does MPICH support cross platform execution?

我发现 MPICH 二进制文件可用于 Windows 和 Linux。但是我不明白我是否可以对两个平台使用由 -n 开关指定的相同可执行文件,或者我是否需要交叉编译我的可执行文件?

尽管您可以交叉编译,但也许您可以将 运行 MPI 应用程序视为由不同的二进制文件(每个平台一个)组成。这样你就可以避免处理交叉编译以及处理所有库。

为了实现这一点,mpiexec [http://www.mpich.org/static/docs/v3.1/www1/mpiexec.html] 允许您传递多个二进制文件(甚至每个平台一个),就像您的应用程序是 MPMD 一样。

Synopsis

mpiexec args executable pgmargs [ : args executable pgmargs ... ]

where args are command line arguments for mpiexec (see below), executable is the name of an executable MPI program, and pgmargs are command line arguments for the executable. Multiple executables can be specified by using the colon notation (for MPMD - Multiple Program Multiple Data applications).

因此,如果您想在 system1 上生成 4 个进程,在 system2 上生成 4 个进程,您可以使用以下命令:

mpiexec -np 4 -host <system1> <binary-system-1> <params> : -np 4 -host <system2> <binary-system-2> <params>