-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mount cuda libray into the container; added the option --privileged t…
…o podman; changed /bin/bash in login mode for docker/podman exec
- Loading branch information
Shuwei Ye
authored and
Shuwei Ye
committed
May 31, 2024
1 parent
c5c8120
commit d163a1c
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
# coding: utf-8 | ||
# version=2024-04-16-r01 | ||
# version=2024-05-31-r01 | ||
# author: Shuwei Ye <[email protected]> | ||
"true" '''\' | ||
myScript="${BASH_SOURCE:-$0}" | ||
|
@@ -514,10 +514,11 @@ def create_container(contCmd, contName, dockerPath, bindOpt, force=False): | |
secOpt = "" | ||
if contCmd == "podman": | ||
lsCmd = "%s run -it --rm %s ls / | tail -1" % (contCmd, dockerPath) | ||
out = run_shellCmd(lsCmd, exitOnFailure=False) | ||
if out.find("Operation not permitted") >= 0: | ||
secOpt = "--security-opt seccomp=unconfined" | ||
# lsCmd = "%s run -it --rm %s ls / | tail -1" % (contCmd, dockerPath) | ||
# out = run_shellCmd(lsCmd, exitOnFailure=False) | ||
# if out.find("Operation not permitted") >= 0: | ||
# secOpt = "--security-opt seccomp=unconfined" | ||
secOpt = "--privileged" | ||
pwd = os.getcwd() | ||
createOpt = "-it -v %s:%s -w %s %s %s %s" % ( | ||
|
@@ -593,7 +594,7 @@ if [[ $# -eq 1 && "$1" =~ ^[Jj]upyter$ ]]; then | |
gid=$(id -g) | ||
runCmd="$contCmd exec -it -u ${uid}:${gid} -e USER=$USER $contName jupyter lab --ip 0.0.0.0" | ||
else | ||
runCmd="$contCmd exec -it $contName /bin/bash" | ||
runCmd="$contCmd exec -it $contName /bin/bash -l" | ||
fi | ||
echo -e "\\n$runCmd\\n" | ||
|
@@ -772,6 +773,8 @@ def setup(args): | |
bindOpt = '--device=' + ','.join(devices) | ||
else: | ||
bindOpt = '--gpus all' | ||
if os.path.exists("/usr/lib64/libcuda.so") and os.path.exists("/usr/lib64/libcuda.so.1"): | ||
bindOpt += " -v /usr/lib64/libcuda.so:/usr/local/nvidia/lib64/libcuda.so -v /usr/lib64/libcuda.so.1:/usr/local/nvidia/lib64/libcuda.so.1" | ||
for path in volumes: | ||
if path.find(':') > 0: | ||
|