Skip to content

Commit 62e2388

Browse files
authored
Merge pull request #60 from singularityhub/al3x609-master
Adding Al3x609 master for nv flag
2 parents f285629 + 72d50cb commit 62e2388

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to
1717
singularity on pypi), and the versions here will coincide with these releases.
1818

1919
## [master](https://github.com/singularityhub/singularity-cli/tree/master)
20+
- adding nvidia flag as nv argument (with default False) to run/exec (0.0.41)
2021
- fixing bug in shell.py, cli should be client (0.0.40)
2122
- remove uri function should only right strip to support relative paths (0.0.39)
2223
- adjusting container build to use correct Github branch (vault/release-2.5)

spython/main/execute.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def execute(self,
3030
writable = False,
3131
contain = False,
3232
bind = None,
33-
stream = False):
33+
stream = False,
34+
nv = False):
3435

3536
''' execute: send a command to a container
3637
@@ -46,13 +47,17 @@ def execute(self,
4647
bind: list or single string of bind paths.
4748
This option allows you to map directories on your host system to
4849
directories within your container using bind mounts
49-
50+
nv: if True, load Nvidia Drivers in runtime (default False)
5051
'''
5152
from spython.utils import check_install
5253
check_install()
5354

5455
cmd = self._init_command('exec')
5556

57+
# nv option leverages any GPU cards
58+
if nv is True:
59+
cmd += ['--nv']
60+
5661
# If the image is given as a list, it's probably the command
5762
if isinstance(image, list):
5863
command = image

spython/main/run.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def run(self,
2929
writable = False,
3030
contain = False,
3131
bind = None,
32-
stream = False):
32+
stream = False,
33+
nv = False):
3334

3435
'''
3536
run will run the container, with or withour arguments (which
@@ -47,12 +48,16 @@ def run(self,
4748
This option allows you to map directories on your host system to
4849
directories within your container using bind mounts
4950
stream: if True, return <generator> for the user to run
50-
51+
nv: if True, load Nvidia Drivers in runtime (default False)
5152
'''
5253
from spython.utils import check_install
5354
check_install()
5455

5556
cmd = self._init_command('run')
57+
58+
# nv option leverages any GPU cards
59+
if nv is True:
60+
cmd += ['--nv']
5661

5762
# No image provided, default to use the client's loaded image
5863
if image is None:

spython/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020

21-
__version__ = "0.0.40"
21+
__version__ = "0.0.41"
2222
AUTHOR = 'Vanessa Sochat'
2323
AUTHOR_EMAIL = '[email protected]'
2424
NAME = 'spython'

0 commit comments

Comments
 (0)