diff --git a/CHANGELOG.md b/CHANGELOG.md index 53473548..cd6b6eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to singularity on pypi), and the versions here will coincide with these releases. ## [master](https://github.com/singularityhub/singularity-cli/tree/master) + - adding nvidia flag as nv argument (with default False) to run/exec (0.0.41) - fixing bug in shell.py, cli should be client (0.0.40) - remove uri function should only right strip to support relative paths (0.0.39) - adjusting container build to use correct Github branch (vault/release-2.5) diff --git a/spython/main/execute.py b/spython/main/execute.py index fce6eb52..5380c5a1 100644 --- a/spython/main/execute.py +++ b/spython/main/execute.py @@ -30,7 +30,8 @@ def execute(self, writable = False, contain = False, bind = None, - stream = False): + stream = False, + nv = False): ''' execute: send a command to a container @@ -46,13 +47,17 @@ def execute(self, bind: list or single string of bind paths. This option allows you to map directories on your host system to directories within your container using bind mounts - + nv: if True, load Nvidia Drivers in runtime (default False) ''' from spython.utils import check_install check_install() cmd = self._init_command('exec') + # nv option leverages any GPU cards + if nv is True: + cmd += ['--nv'] + # If the image is given as a list, it's probably the command if isinstance(image, list): command = image diff --git a/spython/main/run.py b/spython/main/run.py index a16b5ab6..a8ce579f 100644 --- a/spython/main/run.py +++ b/spython/main/run.py @@ -29,7 +29,8 @@ def run(self, writable = False, contain = False, bind = None, - stream = False): + stream = False, + nv = False): ''' run will run the container, with or withour arguments (which @@ -47,12 +48,16 @@ def run(self, This option allows you to map directories on your host system to directories within your container using bind mounts stream: if True, return for the user to run - + nv: if True, load Nvidia Drivers in runtime (default False) ''' from spython.utils import check_install check_install() cmd = self._init_command('run') + + # nv option leverages any GPU cards + if nv is True: + cmd += ['--nv'] # No image provided, default to use the client's loaded image if image is None: diff --git a/spython/version.py b/spython/version.py index 1582ccac..da8c86fd 100644 --- a/spython/version.py +++ b/spython/version.py @@ -18,7 +18,7 @@ -__version__ = "0.0.40" +__version__ = "0.0.41" AUTHOR = 'Vanessa Sochat' AUTHOR_EMAIL = 'vsochat@stanford.edu' NAME = 'spython'