-
Notifications
You must be signed in to change notification settings - Fork 100
Add support for --gpus options in Rocker (shm merged separately) #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -468,3 +468,52 @@ def register_arguments(parser, defaults): | |
| default=defaults.get(GroupAdd.get_name(), None), | ||
| action='append', | ||
| help="Add additional groups to join.") | ||
|
|
||
| class ShmSize(RockerExtension): | ||
| @staticmethod | ||
| def get_name(): | ||
| return 'shm_size' | ||
|
|
||
| def __init__(self): | ||
| self.name = ShmSize.get_name() | ||
|
|
||
| def get_preamble(self, cliargs): | ||
| return '' | ||
|
|
||
| def get_docker_args(self, cliargs): | ||
| args = '' | ||
| shm_size = cliargs.get('shm_size', None) | ||
| if shm_size: | ||
| args += f' --shm-size={shm_size} ' | ||
| return args | ||
|
|
||
| @staticmethod | ||
| def register_arguments(parser, defaults={}): | ||
| parser.add_argument('--shm-size', | ||
| default=defaults.get('shm_size', None), | ||
| help="Set the size of the shared memory for the container (e.g., 512m, 1g).") | ||
|
|
||
|
|
||
| class Gpus(RockerExtension): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the cross coupling can you move this to the nvidia_extensions file instead? It's not explicitly nvidia but I'd like to keep them colocated. And that file could potentially be renamed in the future with it's expanded scope. The X11 class is already not nvidia tied. |
||
| @staticmethod | ||
| def get_name(): | ||
| return 'gpus' | ||
|
|
||
| def __init__(self): | ||
| self.name = Gpus.get_name() | ||
|
|
||
| def get_preamble(self, cliargs): | ||
| return '' | ||
|
|
||
| def get_docker_args(self, cliargs): | ||
| args = '' | ||
| shm_size = cliargs.get('gpus', None) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like some copy and paste here |
||
| if shm_size: | ||
| args += f' --gpus {shm_size} ' | ||
| return args | ||
|
|
||
| @staticmethod | ||
| def register_arguments(parser, defaults={}): | ||
| parser.add_argument('--gpus', | ||
| default=defaults.get('gpus', None), | ||
| help="Set the indices of GPUs to use") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in alphabetical order.