MCPcopy
hub / github.com/openai/improved-diffusion / get_rank_without_mpi_import

Function get_rank_without_mpi_import

improved_diffusion/logger.py:403–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

401
402
403def get_rank_without_mpi_import():
404 # check environment variables here instead of importing mpi4py
405 # to avoid calling MPI_Init() when this module is imported
406 for varname in ["PMI_RANK", "OMPI_COMM_WORLD_RANK"]:
407 if varname in os.environ:
408 return int(os.environ[varname])
409 return 0
410
411
412def mpi_weighted_mean(comm, local_name2valcount):

Callers 1

configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected