-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·58 lines (52 loc) · 1.48 KB
/
run.sh
File metadata and controls
executable file
·58 lines (52 loc) · 1.48 KB
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/sh
# =============================================================================
# Created on Wed Jun 07 2023 16:09:02
# Author: Mukai (Tom Notch) Yu
# Email: mukaiy@andrew.cmu.edu
# Affiliation: Carnegie Mellon University, Robotics Institute, the AirLab
#
# Copyright Ⓒ 2023 Mukai (Tom Notch) Yu
# =============================================================================
. "$(dirname "$0")"/variables.sh
xhost +local:root
XAUTH=/tmp/.docker.xauth
AVAILABLE_CORES=$(($(nproc) - 1))
if [ ! -f "$XAUTH" ]; then
touch "$XAUTH"
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ -n "$xauth_list" ]; then
echo "$xauth_list" | xauth -f "$XAUTH" nmerge -
else
touch "$XAUTH"
fi
chmod a+r "$XAUTH"
fi
if [ "$(docker ps -a -q -f name="$CONTAINER_NAME")" ]; then
echo "A container with name ""$CONTAINER_NAME"" is running, force removing it"
docker rm -f "$CONTAINER_NAME"
echo "Done"
fi
docker run \
--name "$CONTAINER_NAME" \
--hostname "$(hostname)" \
--privileged \
--platform=linux/amd64 \
--cpus "$AVAILABLE_CORES" \
--gpus all \
--runtime nvidia \
--network host \
--ipc host \
--pid host \
--ulimit core=-1 \
--group-add audio \
--group-add video \
-e DISPLAY="$DISPLAY" \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY="$XAUTH" \
-v /var/lib/systemd/coredump/:/cores \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-v "$XAUTH"":""$XAUTH" \
-v "$(dirname "$0")"/../:/root/BagX/ \
-v "$DATASET_PATH":/root/data \
--rm \
-itd "$DOCKER_USER"/"$IMAGE_NAME":"$IMAGE_TAG"