https://github.com/cwsmith/openmpienvvartest
https://github.com/cwsmith/openmpienvvartest
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cwsmith/openmpienvvartest
- Owner: cwsmith
- License: mit
- Created: 2020-04-13T13:11:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T13:24:30.000Z (about 6 years ago)
- Last Synced: 2025-03-01T00:39:14.053Z (over 1 year ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openmpiEnvVarTest
Demonstration of environment variables not being passed from the job script to
processes launched by Spectrum mpirun.
This behavior becomes an issue for large applications that read multiple
environment variables, depend on `LD_LIBRARY_PATH` for finding libraries
at runtime, use OpenMP environment settings, etc. .
## contents
build.sh - build script
helloMPI.c - hello world source code
LICENSE - legal stuff
README.md - this file
runAimos.sh - slurm run script calling mpirun
submitAimos.sh - slurm submission command... in a script
## build and run
On AiMOS:
```
./build.sh
# run the hello world program on two nodes, four processes per node
# the second argument is the path to the script passed to sbatch
./submitAimos.sh 2 ./runAimos.sh
```
You should see the following output (in some order) in the `slurm-####.out`
file:
```
ranks 8
rank 0 cake 42
rank 2 cake 42
rank 4 cake (null)
rank 6 cake (null)
rank 5 cake (null)
rank 7 cake (null)
rank 1 cake 42
done
rank 3 cake 42
```
Note, that processes on the first node see the variable but on the second node
it is unset.
## some mitigations
- Use the openmpi deprecated `-x cake=42` arg
- Instead of passing the executable (`helloMPI`) directly to mpirun, instead
pass the following to launch a shell, set the var, then run the executable
`/bin/bash -c "export cake=42; ./helloMPI"`