Skip to content

Instantly share code, notes, and snippets.

@chengscott
Last active June 14, 2023 14:55
Show Gist options
  • Save chengscott/f82735756d831643633f4453631f9980 to your computer and use it in GitHub Desktop.
Save chengscott/f82735756d831643633f4453631f9980 to your computer and use it in GitHub Desktop.
Cray MPI Wrapper
#!/usr/bin/env python
import os
import sys
import shlex
os.putenv('RANK', os.getenv('PMI_RANK'))
os.putenv('WORLD_SIZE', os.getenv('PMI_SIZE'))
os.putenv('LOCAL_RANK', os.getenv('PMI_LOCAL_RANK'))
os.putenv('LOCAL_SIZE', os.getenv('PMI_LOCAL_SIZE'))
argv = []
if os.getenv('PMI_RANK') == '0':
argv = shlex.split(os.getenv('WRAPPER_CMD'))
argv += sys.argv[1:]
os.execvp(argv[0], argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment