1

When I run

mpirun -np 4 mpi_script.sh

I get the error

Open MPI tried to fork a new process via the "execve" system call but failed.
...
Error:             Exec format error

despite the fact that I can run the script with ./mpi_script.sh

JobJob
  • 3,822
  • 3
  • 33
  • 34

1 Answers1

2

In my case the problem was I didn't have a shebang.

Adding #!/usr/bin/env bash to the top of my script fixed it:

#!/usr/bin/env bash

# rest of script
# ... 

N.b. be sure that the file has execute permissions:

chmod +x mpi_script.sh
JobJob
  • 3,822
  • 3
  • 33
  • 34