mpirun 无法识别 $PATH 中的程序

Mar*_*tin 4 path mpi

不知何故mpirun未能承认我的$PATH. PyroDist我所拥有的程序$PATH有效:

$ PyroDist
Can't find asked option -in
PyroDist - pairwise distance matrix from flowgrams
-in     string            flow file name
-out    stub              out file stub
Options:
-ni                       no index in dat file
-rin    string            lookup file name
Run Code Online (Sandbox Code Playgroud)

并使用mpirun完整路径运行它也可以:

$ mpirun -np 4 ../bin/PyroDist -in C005.dat -out foo
0: Read data
0: Broadcast data
0: Broadcast flows
nN=2094 nM=360 nSize=753840
Run Code Online (Sandbox Code Playgroud)

但这失败了:

$ mpirun -np 4 PyroDist
Missing: program name
Program PyroDist either does not exist, is not 
executable, or is an erroneous argument to mpirun.
Run Code Online (Sandbox Code Playgroud)

由于我将使用一组复杂的工作流,因此使用完整路径是不可行的。有任何想法吗?

(Linux 2.6.32 上的 openmpi 1.2.7)

Sté*_*nez 5

mpirun可能使用execv()调用来运行程序而不是调用execvp()(它会在PATH)。

第一个解决方法:让 shell 自己查找命令:

mpirun -np 4 $(which PyroDist) -in C005.dat -out foo
Run Code Online (Sandbox Code Playgroud)

否则:我能想到的两个(不太好)的解决方法:

  1. /usr/bin/env与参数一起使用PyroDist,但这需要mpirun允许以某种方式与程序一起传递参数。

  2. 编写自己的包装器,例如:

    #!/bin/sh
    PyroDist
    
    Run Code Online (Sandbox Code Playgroud)

    并将其放置在具有“固定”相对路径的某处。