1

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 Answers1

0

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.

Gairfowl
  • 2,226
  • 6
  • 9