JobJob
JobJob

Reputation: 4137

Error when using mpirun with a shell script

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

Upvotes: 1

Views: 3176

Answers (1)

JobJob
JobJob

Reputation: 4137

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

Upvotes: 2

Related Questions