publish.sh 2.65 KB
Newer Older
1
2
#!/bin/bash

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# The script launches a docker container to run ASV benchmarks. We use the same docker
# image as our CI (i.e., dgllib/dgl-ci-gpu:conda). It performs the following steps:
#
#   1. Start a docker container of the given machine name. The machine name will be
#      displayed on the generated website.
#   2. Copy `.git` into the container. It allows ASV to determine the repository information
#      such as commit hash, branches, etc.
#   3. Copy this folder into the container including the ASV configuration file `asv.conf.json`.
#      This means any changes to the files in this folder do not
#      require a git commit. By contrast, to correctly benchmark your changes to the core
#      library (e.g., "python/dgl"), you must call git commit first.
#   4. It then calls the `run.sh` script inside the container. It will invoke `asv run`.
#      You can change the command such as specifying the benchmarks to run or adding some flags.
#   5. After benchmarking, it copies the generated `results` and `html` folders back to
#      the host machine.
#

20
21
22
23
24
25
26
27
28
if [ $# -eq 2 ]; then
    MACHINE=$1
    DEVICE=$2
else
    echo "publish.sh <machine_name> <device>"
    exit 1
fi

WS_ROOT=/asv/dgl
29
docker pull public.ecr.aws/s1o7b3d9/benchmakrk_pyg_dgl:cu111_torch181_pyg170
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
if [ -z "$DGL_REG_CONF"]; then
    DOCKER_ENV_OPT="$DOCKER_ENV_OPT"
else
    DOCKER_ENV_OPT=" -e DGL_REG_CONF=$DGL_REG_CONF $DOCKER_ENV_OPT"
fi

if [ -z "$INSTANCE_TYPE"]; then
    DOCKER_ENV_OPT="$DOCKER_ENV_OPT"
else
    DOCKER_ENV_OPT=" -e INSTANCE_TYPE=$INSTANCE_TYPE $DOCKER_ENV_OPT"
fi

if [ -z "$MOUNT_PATH"]; then
    DOCKER_MOUNT_OPT=""
else
    DOCKER_MOUNT_OPT="-v ${MOUNT_PATH}:/tmp/dataset -v ${MOUNT_PATH}/dgl_home/:/root/.dgl/"
fi

echo $HOME
echo "Mount Point: ${DOCKER_MOUNT_OPT}"
echo "Env opt: ${DOCKER_ENV_OPT}"
echo "DEVICE: ${DEVICE}"

if [[ $DEVICE == "cpu" ]]; then
    docker run --name dgl-reg \
        --rm \
        $DOCKER_MOUNT_OPT \
        $DOCKER_ENV_OPT \
Jinjing Zhou's avatar
Jinjing Zhou committed
58
        --shm-size="16g" \
59
        --hostname=$MACHINE -dit public.ecr.aws/s1o7b3d9/benchmakrk_pyg_dgl:cu111_torch181_pyg170 /bin/bash
60
61
else
    docker run --name dgl-reg \
62
        --rm --gpus all \
63
64
        $DOCKER_MOUNT_OPT \
        $DOCKER_ENV_OPT \
Jinjing Zhou's avatar
Jinjing Zhou committed
65
        --shm-size="16g" \
66
        --hostname=$MACHINE -dit public.ecr.aws/s1o7b3d9/benchmakrk_pyg_dgl:cu111_torch181_pyg170 /bin/bash
67
fi
68
69

docker exec dgl-reg mkdir -p $WS_ROOT
70
71
docker cp ../../.git dgl-reg:$WS_ROOT
docker cp ../ dgl-reg:$WS_ROOT/benchmarks/
72
docker cp torch_gpu_pip.txt dgl-reg:/asv
73
74
75
docker exec $DOCKER_ENV_OPT dgl-reg bash $WS_ROOT/benchmarks/run.sh $DEVICE
docker cp dgl-reg:$WS_ROOT/benchmarks/results ../
docker cp dgl-reg:$WS_ROOT/benchmarks/html ../
76
docker stop dgl-reg