Reputation: 513
I'm using OpenMPI and mpirun, and my MPI processes are divided among multiple Docker containers. Each Docker container is running its own process that has an environment variable, say, FOO
, where $FOO
(i.e. its value) differs depending on the container. The process running in the master node is the one that calls the mpirun
. Is there a way for me to get each worker node to have FOO
set in its MPI process in the mpirun command?
My question is different from this one in that the values of the environment variables may differ from container to container. Using -x
in the mpirun command exports the master node's value for the environment variable, so that doesn't work for what I'm trying to do.
edit: revised to clarify based on the comment
Upvotes: 1
Views: 812
Reputation: 513
Posting in case this ends up being helpful for anyone else -
I ended up solving this by writing the environment variables to /etc/environment
before starting the MPI process. My Docker images use Ubuntu as a base, and /etc/environment
is honored even in a non-interactive, non-login shell (which is what MPI uses).
Upvotes: 0