0

While trying to run the following .sh file I get an error from mpirun:

The file: (additional python config omitted for brevity)

NB_MPI_WORKERS=2
SEED=0

mpirun --n ${NB_MPI_WORKERS} python start.py --base_path ~/temp --seed ${SEED}

The error:

Open MPI has detected that a parameter given to a command line
option does not match the expected format:

  Option: n
  Param:  2

This is frequently caused by omitting to provide the parameter
to an option that requires one. Please check the command line and try again.

I have confirmed that simply replacing ${NB_MPI_WORKERS} with 2 does work, so I'm a bit confused on where the error is, especially since ${seed} is working.

Can anyone clarify, please? Is it actually an issue of formatting, or maybe type?

Versions:

  • Linux Mint 20.2
  • Open MPI 4.1.2
4
  • Did you edit and save the file on a Windows system? Commented Jan 17, 2022 at 7:44
  • No, but the command also complains about $'\r' command not found, which just correlates to empty lines in the file. Could this be the cause? Commented Jan 17, 2022 at 15:42
  • Yes, that's another typical symptom of using a DOS/Windows text file on a Unix system, hence my previous comment. Commented Jan 17, 2022 at 16:02
  • I converted the file from dos to unix and it now runs correctly. Thank you. Commented Jan 17, 2022 at 20:22

1 Answer 1

2

As suggested in the comments, the solution was to convert the file from DOS text file format to Unix text file format to replace the line endings.

Since the file was in DOS text format, the trailing carriage-return character got added onto the values of both NB_MPI_WORKERS and SEED. In the case of SEED, it didn't seem to be a problem as the value was somehow properly handled by the Python script. But in the case of the other variable, it meant the --n option got a value that was not recognized as legal.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.