Skip to content

Detect if code is run with 'srun' #372

Answered by dalcinl
Sebastian-Belkner asked this question in Q&A
Discussion options

You must be logged in to vote

Looks like your MPI implementation is using PMI for process management. If that is the case, you can use:

import os
if "PMI_SIZE" in os.environ:
    from mpi4py import MPI
else:
    MPI = None

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Sebastian-Belkner
Comment options

@dalcinl
Comment options

@Sebastian-Belkner
Comment options

Answer selected by Sebastian-Belkner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants