Is there a way to use the sys module in Python to return an mpiexec -n parameter?
For example, say we run in Git Bash:
mpiexec -n 6 python cuda.py
How do we return the number after -n within the program? Will os.environ or some sort of sys module (or click) help with achieving this?
from mpi4py import MPI
comm = MPI.COMM_WORLD
nprocs = comm.Get_size()
It is possible that your MPI implementation also makes an environment variable available, but that's implementation dependent.