task_unit_test.sh 1.34 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

Minjie Wang's avatar
Minjie Wang committed
36
37
38
python3 -m pip install pytest psutil pyyaml pydantic pandas rdflib ogb || fail "pip install"
python3 -m pytest -v --junitxml=pytest_compute.xml --durations=100 tests/compute || fail "compute"
python3 -m pytest -v --junitxml=pytest_backend.xml --durations=100 tests/$DGLBACKEND || fail "backend-specific"
39

40
41

export PYTHONUNBUFFERED=1
42
export OMP_NUM_THREADS=1
43
export DMLC_LOG_DEBUG=1
44
if [ $2 != "gpu" ] && [ $DGLBACKEND == "pytorch" ]; then
Minjie Wang's avatar
Minjie Wang committed
45
46
47
    python3 -m pip install filelock
    python3 -m pytest -v --capture=tee-sys --junitxml=pytest_distributed.xml --durations=100 tests/distributed/*.py || fail "distributed"
    PYTHONPATH=tools:$PYTHONPATH python3 -m pytest -v --capture=tee-sys --junitxml=pytest_tools.xml --durations=100 tests/tools/*.py || fail "tools"
48
fi