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

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

10
11
12
13
14
CMAKE_VARS="-DBUILD_CPP_TEST=ON -DUSE_OPENMP=ON -DBUILD_TORCH=ON"
# 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.
CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
15

16
if [ "$1" == "gpu" ]; then
17
    CMAKE_VARS="-DUSE_CUDA=ON -DUSE_NCCL=ON $CMAKE_VARS"
18
19
fi

20
if [ -d build ]; then
21
    rm -rf build
22
23
24
25
26
27
fi
mkdir build

rm -rf _download

pushd build
28
cmake $CMAKE_VARS ..
Jinjing Zhou's avatar
Jinjing Zhou committed
29
make -j
30
31
32
popd

pushd python
VoVAllen's avatar
VoVAllen committed
33
34
35
for backend in pytorch mxnet tensorflow
do 
conda activate "${backend}-ci"
36
rm -rf build *.egg-info dist
VoVAllen's avatar
VoVAllen committed
37
pip uninstall -y dgl
Minjie Wang's avatar
Minjie Wang committed
38
# test install
39
python3 setup.py install
Minjie Wang's avatar
Minjie Wang committed
40
41
# test inplace build (for cython)
python3 setup.py build_ext --inplace
VoVAllen's avatar
VoVAllen committed
42
done
43
popd