build_dgl.sh 1.52 KB
Newer Older
1
#!/bin/bash
2
set -e
VoVAllen's avatar
VoVAllen committed
3
. /opt/conda/etc/profile.d/conda.sh
4

5
if [ $# -ne 1 ]; then
6
    echo "Device argument required, can be cpu, gpu or cugraph"
7
8
9
    exit -1
fi

10
11
12
13
14
15
16
# Build for testing.
CMAKE_VARS="-DBUILD_TYPE=test"

if [[ $1 != "cpu" ]]; then
    CMAKE_VARS="$CMAKE_VARS -DUSE_CUDA=ON"
fi

17
18
19
# This is a semicolon-separated list of Python interpreters containing PyTorch.
# The value here is for CI.  Replace it with your own or comment this whole
# statement for default Python interpreter.
20
if [ "$1" != "cugraph" ]; then
21
22
23
    # We do not build pytorch for cugraph because currently building
    # pytorch against all the supported cugraph versions is not supported
    # See issue: https://github.com/rapidsai/cudf/issues/8510
24
    CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
25
26
else
    # Disable sparse build as cugraph docker image lacks cuDNN.
27
    CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=OFF -DBUILD_SPARSE=OFF"
28
29
fi

30
if [ -d build ]; then
31
    rm -rf build
32
33
34
35
36
37
fi
mkdir build

rm -rf _download

pushd build
38
cmake $CMAKE_VARS ..
Jinjing Zhou's avatar
Jinjing Zhou committed
39
make -j
40
41
42
popd

pushd python
43
44
45
46
47
if [[ $1 == "cugraph" ]]; then
    rm -rf build *.egg-info dist
    pip uninstall -y dgl
    # test install
    python3 setup.py install
48
49
    # test build (for cython)
    python3 setup.py build_ext
50
51
52
53
54
55
56
57
else
    for backend in pytorch mxnet tensorflow
    do
    conda activate "${backend}-ci"
    rm -rf build *.egg-info dist
    pip uninstall -y dgl
    # test install
    python3 setup.py install
58
59
    # test build (for cython)
    python3 setup.py build_ext
60
61
    done
fi
62
popd