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

VoVAllen's avatar
VoVAllen committed
3
4
. /opt/conda/etc/profile.d/conda.sh

5
6
7
8
9
10
function fail {
    echo FAIL: $@
    exit -1
}

function usage {
11
    echo "Usage: $0 backend device"
12
13
}

14
if [ $# -ne 2 ]; then
15
    usage
16
    fail "Error: must specify backend and device"
17
18
fi

Minjie Wang's avatar
Minjie Wang committed
19
export DGLBACKEND=$1
20
export DGLTESTDEV=$2
Minjie Wang's avatar
Minjie Wang committed
21
22
23
export DGL_LIBRARY_PATH=${PWD}/build
export PYTHONPATH=tests:${PWD}/python:$PYTHONPATH
export DGL_DOWNLOAD_DIR=${PWD}
VoVAllen's avatar
VoVAllen committed
24
export TF_FORCE_GPU_ALLOW_GROWTH=true
25
unset TORCH_ALLOW_TF32_CUBLAS_OVERRIDE
VoVAllen's avatar
VoVAllen committed
26

27
28
29
30
31
32
33
if [ $2 == "gpu" ] 
then
  export CUDA_VISIBLE_DEVICES=0
else
  export CUDA_VISIBLE_DEVICES=-1
fi

VoVAllen's avatar
VoVAllen committed
34
35
conda activate ${DGLBACKEND}-ci

36
37
if [ $DGLBACKEND == "mxnet" ]
then
38
  python3 -m pytest -v --junitxml=pytest_compute.xml --durations=100 --ignore=tests/python/common/test_ffi.py tests/python/common || fail "common"
39
else
40
  python3 -m pytest -v --junitxml=pytest_common.xml --durations=100 tests/python/common || fail "common"
41
fi
42
python3 -m pytest -v --junitxml=pytest_backend.xml --durations=100 tests/python/$DGLBACKEND || fail "backend-specific"