Skip to content

Commit d40a3c3

Browse files
Rhett-YingfrozenbugsUbuntu
authored
1.1.x candidate (#6155)
Co-authored-by: Hongzhi (Steve), Chen <[email protected]> Co-authored-by: Ubuntu <[email protected]>
1 parent d95058f commit d40a3c3

File tree

6 files changed

+132
-27
lines changed

6 files changed

+132
-27
lines changed

CMakeLists.txt

+100-15
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,106 @@ include(cmake/util/Util.cmake)
1313
include(cmake/util/MshadowUtil.cmake)
1414
include(cmake/util/FindCUDA.cmake)
1515

16-
# NOTE: do not modify this file to change option values.
17-
# Use bash script/build_dgl.sh -e '-DOPTION=VALUE' through command-line.
18-
dgl_option(USE_CUDA "Build with CUDA" OFF)
19-
dgl_option(USE_OPENMP "Build with OpenMP" ON)
20-
dgl_option(USE_LIBXSMM "Build with LIBXSMM library optimization" ON)
21-
dgl_option(BUILD_CPP_TEST "Build cpp unittest executables" OFF)
22-
dgl_option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
23-
dgl_option(USE_S3 "Build with S3 support" OFF)
24-
dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if needed
25-
dgl_option(REBUILD_LIBXSMM "Clean LIBXSMM build cache at every build" OFF) # Set env HADOOP_HDFS_HOME if needed
26-
dgl_option(USE_EPOLL "Build with epoll for socket communicator" ON)
27-
dgl_option(TP_BUILD_LIBUV "Build libuv together with tensorpipe (only impacts Linux)" ON)
28-
dgl_option(BUILD_TORCH "Build the PyTorch plugin" OFF)
29-
dgl_option(BUILD_SPARSE "Build DGL sparse library" ON)
30-
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)
16+
# TODO(#5475): Clean up the old flags after CI and regression framework adopt to the new setup.
17+
if (NOT DEFINED BUILD_TYPE)
18+
dgl_option(USE_CUDA "Build with CUDA" OFF)
19+
dgl_option(USE_OPENMP "Build with OpenMP" ON)
20+
dgl_option(USE_LIBXSMM "Build with LIBXSMM library optimization" ON)
21+
dgl_option(BUILD_CPP_TEST "Build cpp unittest executables" OFF)
22+
dgl_option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
23+
dgl_option(USE_S3 "Build with S3 support" OFF)
24+
dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if needed
25+
dgl_option(REBUILD_LIBXSMM "Clean LIBXSMM build cache at every build" OFF) # Set env HADOOP_HDFS_HOME if needed
26+
dgl_option(USE_EPOLL "Build with epoll for socket communicator" ON)
27+
dgl_option(BUILD_TORCH "Build the PyTorch plugin" OFF)
28+
dgl_option(BUILD_SPARSE "Build DGL sparse library" ON)
29+
dgl_option(BUILD_GRAPHBOLT "Build Graphbolt library" OFF)
30+
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)
31+
else()
32+
# Options for building DGL.
33+
# NOTE: do not modify this file to change option values.
34+
# Use bash script/build_dgl.sh -e '-DOPTION=VALUE' through command-line.
35+
dgl_option(
36+
BUILD_TYPE
37+
"Type of the build: dev, test or release"
38+
"dev"
39+
)
40+
message(STATUS "Build for ${BUILD_TYPE}")
41+
42+
dgl_option(
43+
USE_CUDA
44+
"Build with CUDA"
45+
OFF
46+
)
47+
dgl_option(
48+
TORCH_PYTHON_INTERPS
49+
"Python interpreter used to build tensoradapter and DGL sparse library"
50+
python3
51+
)
52+
53+
# Options for building DGL features, supported: "none", "dev", "test", "release", "all".
54+
# NOTE: do not modify this file to change option values.
55+
# Use bash script/build_dgl.sh -e '-DFEATURE_NAME=ON/OFF' through command-line.
56+
dgl_feature_option(
57+
BUILD_SPARSE
58+
"Build DGL sparse library"
59+
"all"
60+
)
61+
dgl_feature_option(
62+
BUILD_TORCH
63+
"Build the PyTorch plugin"
64+
"all"
65+
)
66+
dgl_feature_option(
67+
USE_EPOLL
68+
"Build with epoll for socket communicator"
69+
"all"
70+
)
71+
dgl_feature_option(
72+
USE_LIBXSMM
73+
"Build with LIBXSMM library optimization"
74+
"all"
75+
)
76+
dgl_feature_option(
77+
USE_OPENMP
78+
"Build with OpenMP"
79+
"all"
80+
)
81+
82+
dgl_feature_option(
83+
BUILD_GRAPHBOLT
84+
"Build Graphbolt library"
85+
"dev" "test"
86+
)
87+
88+
dgl_feature_option(
89+
LIBCXX_ENABLE_PARALLEL_ALGORITHMS
90+
"Enable the parallel algorithms library. This requires the PSTL to be available."
91+
"none"
92+
)
93+
dgl_feature_option(
94+
REBUILD_LIBXSMM
95+
"Clean LIBXSMM build cache at every build"
96+
"none"
97+
)
98+
dgl_feature_option(
99+
USE_HDFS
100+
"Build with HDFS support"
101+
"none"
102+
) # Set env HADOOP_HDFS_HOME if needed
103+
dgl_feature_option(
104+
USE_S3
105+
"Build with S3 support"
106+
"none"
107+
)
108+
109+
# Build cpp test only in test build.
110+
dgl_feature_option(
111+
BUILD_CPP_TEST
112+
"Build cpp unittest executables"
113+
"test"
114+
)
115+
endif()
31116

32117
# Set debug compile option for gdb, only happens when -DCMAKE_BUILD_TYPE=DEBUG
33118
if (NOT MSVC)

cmake/util/Util.cmake

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ macro(__dgl_option variable description value)
44
endif()
55
endmacro()
66

7+
#######################################################
8+
# An option to specify the build type for a feature.
9+
# Usage:
10+
# dgl_feature_option(<option_variable> "doc string" "dev" "release")
11+
macro(dgl_feature_option variable description)
12+
set(__value "")
13+
foreach(arg ${ARGN})
14+
if(arg STREQUAL "all")
15+
__dgl_option(${variable} "${description}" ON)
16+
elseif(arg STREQUAL "dev" OR arg STREQUAL "test" OR arg STREQUAL "release")
17+
list(APPEND __value ${arg})
18+
endif()
19+
endforeach()
20+
21+
if(${BUILD_TYPE} IN_LIST __value)
22+
__dgl_option(${variable} "${description}" ON)
23+
else()
24+
__dgl_option(${variable} "${description}" OFF)
25+
endif()
26+
endmacro()
27+
728
#######################################################
829
# An option that the user can select. Can accept condition to control when option is available for user.
930
# Usage:

script/build_dgl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if [[ -z ${cuda} ]]; then
6969
else
7070
mkdir -p build
7171
cd build
72-
cmake -DUSE_CUDA=${cuda} ${extra_args} ..
72+
cmake -DBUILD_TYPE=dev -DUSE_CUDA=${cuda} ${extra_args} ..
7373
fi
7474

7575
if [[ ${PWD} == "${DGL_HOME}/build" ]]; then

tests/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ The code organization goes as follows:
2121
Compile with unittest by executing the command below
2222
```
2323
# Assume current directory is the root directory of dgl, and googletest submodule is initialized
24-
mkdir build
25-
cd build
26-
cmake .. -DBUILD_CPP_TEST=1
27-
make -j${nproc}
24+
bash script/build_dgl.sh -c -r -e '-DBUILD_TYPE=test'
2825
./runUnitTests
2926
```

tests/scripts/build_dgl.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET TEMP=%WORKSPACE%\tmp
1313
SET TMPDIR=%WORKSPACE%\tmp
1414

1515
PUSHD build
16-
cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DUSE_OPENMP=ON -DBUILD_TORCH=ON -Dgtest_force_shared_crt=ON -DDMLC_FORCE_SHARED_CRT=ON -DBUILD_CPP_TEST=1 -DCMAKE_CONFIGURATION_TYPES="Release" -DTORCH_PYTHON_INTERPS=python -DBUILD_SPARSE=ON .. -G "Visual Studio 16 2019" || EXIT /B 1
16+
cmake -DBUILD_TYPE=test -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -Dgtest_force_shared_crt=ON -DDMLC_FORCE_SHARED_CRT=ON -DCMAKE_CONFIGURATION_TYPES="Release" -DTORCH_PYTHON_INTERPS=python .. -G "Visual Studio 16 2019" || EXIT /B 1
1717
msbuild dgl.sln /m /nr:false || EXIT /B 1
1818
COPY /Y Release\runUnitTests.exe .
1919
POPD

tests/scripts/build_dgl.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ if [ $# -ne 1 ]; then
77
exit -1
88
fi
99

10-
CMAKE_VARS="-DBUILD_CPP_TEST=ON -DUSE_OPENMP=ON"
10+
# Build for testing.
11+
CMAKE_VARS="-DBUILD_TYPE=test"
12+
13+
if [[ $1 != "cpu" ]]; then
14+
CMAKE_VARS="$CMAKE_VARS -DUSE_CUDA=ON"
15+
fi
16+
1117
# This is a semicolon-separated list of Python interpreters containing PyTorch.
1218
# The value here is for CI. Replace it with your own or comment this whole
1319
# statement for default Python interpreter.
1420
if [ "$1" != "cugraph" ]; then
1521
# We do not build pytorch for cugraph because currently building
1622
# pytorch against all the supported cugraph versions is not supported
1723
# See issue: https://github.com/rapidsai/cudf/issues/8510
18-
CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=ON -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
24+
CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
1925
else
2026
# Disable sparse build as cugraph docker image lacks cuDNN.
2127
CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=OFF -DBUILD_SPARSE=OFF"
2228
fi
2329

24-
if [[ $1 != "cpu" ]]; then
25-
CMAKE_VARS="-DUSE_CUDA=ON $CMAKE_VARS"
26-
fi
27-
2830
if [ -d build ]; then
2931
rm -rf build
3032
fi

0 commit comments

Comments
 (0)