使用mpirun/mpiexec为可执行文件使用别名时出错。

huangapple go评论58阅读模式
英文:

Error with using alias for executable with mpirun/mpiexec

问题

I have set up an alias for my LAMMPS executable, lmp_mpi, in my .zshrc file. Using just the alias on its own works fine, but when coupled with mpirun/mpiexec, which have worked previously when I just used the file path for lmp_mpi instead of the alias, I get the following error:

Input: mpirun -np 2 lammps -in in.fileName

Output:

mpiexec was unable to find the specified executable file, and
therefore did not launch the job. This error was first reported for
process rank 0; it may have occurred for other processes as well.

NOTE: A common cause for this error is misspelling a mpiexec command
line parameter option (remember that mpiexec interprets the first
unrecognized command line token as the executable).

Node: dhcp-vl2041-10441 Executable: lammps

This has been a headache for me to resolve. My most straightforward guess is mpirun/mpiexec don't recognize the alias, but I am not quite sure. Any input would be appreciated.

I have verified that my alias for LAMMPS does work, listed as the following:

alias
lammps='/Users/myname/Documents/Project_Packages/lammps-23Jun2022/src/lmp_mpi'

And when I run just the alias, the executable is run on the command window.

I have read a lot on alias, but I haven't quite found a similar issue, especially with LAMMPS.

英文:

I have set up an alias for my LAMMPS executable, lmp_mpi, in my .zshrc file. Using just the alias on its own works fine, but when coupled with mpirun/mpiexec, which have worked previously when I just used the file path for lmp_mpi instead of the alias, I get the following error:

Input: mpirun -np 2 lammps -in in.fileName

Output:

> mpiexec was unable to find the specified executable file, and
> therefore did not launch the job. This error was first reported for
> process rank 0; it may have occurred for other processes as well.
>
> NOTE: A common cause for this error is misspelling a mpiexec command
> line parameter option (remember that mpiexec interprets the first
> unrecognized command line token as the executable).
>
> Node: dhcp-vl2041-10441 Executable: lammps

This has been a headache for me to resolve. My most straightforward guess is mpirun/mpiexec don't recognize the alias, but I am not quite sure. Any input would be appreciated.

I have verified that my alias for LAMMPS does work, listed as the following:

> alias
> lammps='/Users/myname/Documents/Project_Packages/lammps-23Jun2022/src/lmp_mpi'

And when I run just the alias, the executable is run on the command window.

I have read a lot on alias, but I haven't quite found a similar issue, especially with LAMMPS.

答案1

得分: 0

尝试将别名更改为“global”别名,并使用 -g

alias -g lammps='/Users/myname/Documents/Project_Packages/lammps-23Jun2022/src/lmp_mpi'

别名只是简单的文本替换。使用普通别名,即不带 -g,只会替换命令行中的第一个标记。全局别名将在命令行中出现为一个独立标记的任何地方展开,例如:

> alias xyz='some longer text'
> print xyz
xyz
> alias -g xyz='some longer text'
> print xyz
some longer text
> print wxyz
wxyz

使用 -g 别名为 lammps,完全展开的路径将传递给 mpirun。别名也可能在意想不到的情况下展开,因此通常最好为全局别名使用相对独特的名称。

英文:

Try changing the alias to a 'global' alias with -g:

alias -g lammps='/Users/myname/Documents/Project_Packages/lammps-23Jun2022/src/lmp_mpi'

Aliases are just simple text substitutions. With a normal alias, i.e. without the -g, only the first token in a line is substituted. A global alias will be expanded anywhere it appears as a distinct token in the command line, e.g.:

> alias xyz='some longer text'
> print xyz
xyz
> alias -g xyz='some longer text'
> print xyz
some longer text
> print wxyz
wxyz

With the -g alias for lammps, the fully-expanded path will be passed to mpirun. The alias may also end up being expanded in unexpected situations, so it's usually best to use fairly unique names for global aliases.

huangapple
  • 本文由 发表于 2023年4月13日 20:58:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76005717.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定