-1

I'm working a small project which needs using OpenMPI to make "mpicc" work. I made a file make_cmd:

#!/bin/bash

module load OpenMPI

However, after executing ./make_cmd, I was told:

mpicc: command not found

But if I just type on the command line: module load OpenMPI, then mpicc is working.

Why is that? Thanks!

user419050
  • 41
  • 2
  • 6

1 Answers1

1

See this answer on neighbouring site.

Because module is an alias/shell function and not a binary program, it's not necessarily available in the non-interactive sub-shell that is created when you run your script. You could probably run source make_cmd though, as that will just run the commands in your current interactive shell. You could ditch the #!/bin/bash line in that case.

Matt
  • 3,677
  • 1
  • 14
  • 24