-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-digits
executable file
·59 lines (47 loc) · 1.79 KB
/
start-digits
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/bash
# Simple script to set appropriate parameters and start digits
# Set DIGITS container and port info here
DIGITS_CONTAINER="nvcr.io/nvidia/digits"
DIGITS_CONTAINER_VER="17.06"
DIGITS_ENV_FILE="$HOME/digits/digits-env.sh"
DIGITS_PORT="5000"
# DIGITS work around for multi-gpu issue in 17.05
DIGITS_WORKAROUND="--shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864"
# General host and user information
IPADDRESS=`hostname -i`
MYUID=`id -u $USER`
MYGID=`id -g $USER`
CONTAINER_NAME="$USER-digits"
# Set up container uid/gid for proper process permissions - otherwise container run with wrong permissions and files not accessible
USER_CMD="-u $MYUID:$MYGID"
# Map additional local directories to be mounted in container
# User Home Directory
MOUNT_CMD="-v $HOME:$HOME "
# Add additional directories
# Example: Mount /data into container as /data
#MOUNT_CMD+="-v /data:/data "
# General format
#MOUNT_CMD+="-v <local dir>:<container dir> "
# Expose container port to system so users can access service. Maps DIGITS port 5000 to specified port.
# Change port number above if running multiple copies of DIGITS
PORT_CMD="-p 5000:$PORT "
# Setup environment variable so DIGITs can find DIGITS directory
DIGITS_ENV_CMD="--env-file=$DIGITS_ENV_FILE"
# Welcome
echo " "
echo "Simple DIGITS Start Script - v0.1"
echo " "
echo "To connect to DIGITS, specify the following URL in your browser:"
echo " "
echo " http://"$IPADDRESS":5000/"
echo " "
echo "Docker commands to control container:"
echo " "
echo " docker ps -a"
echo " docker stop $CONTAINER_NAME"
echo " docker rm $CONTAINER_NAME"
echo " "
# run docker
CMD="nvidia-docker run --name $CONTAINER_NAME $USER_CMD $PORTS $PORT_CMD $MOUNT_CMD $DIGITS_ENV_CMD $DIGITS_WORKAROUND --rm -ti $DIGITS_CONTAINER:$DIGITS_CONTAINER_VER"
echo "Running: $CMD"
$rc = `$CMD`