File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ ENVIRONMENT_VARIABLES=
4040REMAINING_ARGS=
4141INTERACTIVE=
4242USE_NIXL_GDS=
43+ RUNTIME=nvidia
44+ WORKDIR=/workspace
4345
4446get_options () {
4547 while : ; do
@@ -97,6 +99,14 @@ get_options() {
9799 missing_requirement " $1 "
98100 fi
99101 ;;
102+ --runtime)
103+ if [ " $2 " ]; then
104+ RUNTIME=$2
105+ shift
106+ else
107+ missing_requirement " $1 "
108+ fi
109+ ;;
100110 --entrypoint)
101111 if [ " $2 " ]; then
102112 ENTRYPOINT=$2
@@ -105,6 +115,14 @@ get_options() {
105115 missing_requirement " $1 "
106116 fi
107117 ;;
118+ --workdir)
119+ if [ " $2 " ]; then
120+ WORKDIR=" $2 "
121+ shift
122+ else
123+ missing_requirement " $1 "
124+ fi
125+ ;;
108126 --privileged)
109127 if [ " $2 " ]; then
110128 PRIVILEGED=$2
@@ -261,7 +279,9 @@ get_options() {
261279 else
262280 NIXL_GDS_CAPS=" "
263281 fi
264-
282+ if [[ " $GPUS " == " none" || " $GPUS " == " NONE" ]]; then
283+ RUNTIME=" "
284+ fi
265285 REMAINING_ARGS=(" $@ " )
266286}
267287
@@ -279,6 +299,8 @@ show_help() {
279299 echo " [-e add environment variable]"
280300 echo " [--mount-workspace set up for local development]"
281301 echo " [-- stop processing and pass remaining args as command to docker run]"
302+ echo " [--workdir set the working directory inside the container]"
303+ echo " [--runtime add runtime variables]"
282304 exit 0
283305}
284306
@@ -304,13 +326,14 @@ ${RUN_PREFIX} docker run \
304326 ${INTERACTIVE} \
305327 ${RM_STRING} \
306328 --network host \
329+ ${RUNTIME: +--runtime " $RUNTIME " } \
307330 --shm-size=10G \
308331 --ulimit memlock=-1 \
309332 --ulimit stack=67108864 \
310333 --ulimit nofile=65536:65536 \
311334 ${ENVIRONMENT_VARIABLES} \
312335 ${VOLUME_MOUNTS} \
313- -w /workspace \
336+ -w " $WORKDIR " \
314337 --cap-add CAP_SYS_PTRACE \
315338 ${NIXL_GDS_CAPS} \
316339 --ipc host \
You can’t perform that action at this time.
0 commit comments