Setting Environment Variables on a Cluster

By default, when you call the MPI launch command mpiexec, the entire launching node environment is passed to the MPI processes. However, if there are undefined variables or variables that are different from what is stored in your environment, you can use -env or -genv options with mpiexec. Each of these options take two arguments- the name and the value of the environment variable to be passed.

-genv NAME1 VALUE1 -genv NAME2 VALUE2

-env NAME VALUE -genv

See these MPICH2 examples on how to set the value of OMP_NUM_THREADS explicitly:

mpiexec -genv OMP_NUM_THREADS 2 ....

mpiexec -n 1 -host first -env OMP_NUM_THREADS 2 test.exe : -n 2 -host second -env OMP_NUM_THREADS 3 test.exe ....

See these Intel MPI examples on how to set the value of MKL_BLACS_MPI explicitly:

mpiexec -genv MKL_BLACS_MPI INTELMPI ....

mpiexec -n 1 -host first -env MKL_BLACS_MPI INTELMPI test.exe : -n 1 -host second -env MKL_BLACS_MPI INTELMPI test.exe.

Optimization Notice: 
For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)