Skip to content

Commit

Permalink
1.1.x candidate (#6155)
Browse files Browse the repository at this point in the history
Co-authored-by: Hongzhi (Steve), Chen <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
3 people authored Aug 14, 2023
1 parent d95058f commit d40a3c3
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 27 deletions.
115 changes: 100 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,106 @@ include(cmake/util/Util.cmake)
include(cmake/util/MshadowUtil.cmake)
include(cmake/util/FindCUDA.cmake)

# NOTE: do not modify this file to change option values.
# Use bash script/build_dgl.sh -e '-DOPTION=VALUE' through command-line.
dgl_option(USE_CUDA "Build with CUDA" OFF)
dgl_option(USE_OPENMP "Build with OpenMP" ON)
dgl_option(USE_LIBXSMM "Build with LIBXSMM library optimization" ON)
dgl_option(BUILD_CPP_TEST "Build cpp unittest executables" OFF)
dgl_option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
dgl_option(USE_S3 "Build with S3 support" OFF)
dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if needed
dgl_option(REBUILD_LIBXSMM "Clean LIBXSMM build cache at every build" OFF) # Set env HADOOP_HDFS_HOME if needed
dgl_option(USE_EPOLL "Build with epoll for socket communicator" ON)
dgl_option(TP_BUILD_LIBUV "Build libuv together with tensorpipe (only impacts Linux)" ON)
dgl_option(BUILD_TORCH "Build the PyTorch plugin" OFF)
dgl_option(BUILD_SPARSE "Build DGL sparse library" ON)
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)
# TODO(#5475): Clean up the old flags after CI and regression framework adopt to the new setup.
if (NOT DEFINED BUILD_TYPE)
dgl_option(USE_CUDA "Build with CUDA" OFF)
dgl_option(USE_OPENMP "Build with OpenMP" ON)
dgl_option(USE_LIBXSMM "Build with LIBXSMM library optimization" ON)
dgl_option(BUILD_CPP_TEST "Build cpp unittest executables" OFF)
dgl_option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
dgl_option(USE_S3 "Build with S3 support" OFF)
dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if needed
dgl_option(REBUILD_LIBXSMM "Clean LIBXSMM build cache at every build" OFF) # Set env HADOOP_HDFS_HOME if needed
dgl_option(USE_EPOLL "Build with epoll for socket communicator" ON)
dgl_option(BUILD_TORCH "Build the PyTorch plugin" OFF)
dgl_option(BUILD_SPARSE "Build DGL sparse library" ON)
dgl_option(BUILD_GRAPHBOLT "Build Graphbolt library" OFF)
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)
else()
# Options for building DGL.
# NOTE: do not modify this file to change option values.
# Use bash script/build_dgl.sh -e '-DOPTION=VALUE' through command-line.
dgl_option(
BUILD_TYPE
"Type of the build: dev, test or release"
"dev"
)
message(STATUS "Build for ${BUILD_TYPE}")

dgl_option(
USE_CUDA
"Build with CUDA"
OFF
)
dgl_option(
TORCH_PYTHON_INTERPS
"Python interpreter used to build tensoradapter and DGL sparse library"
python3
)

# Options for building DGL features, supported: "none", "dev", "test", "release", "all".
# NOTE: do not modify this file to change option values.
# Use bash script/build_dgl.sh -e '-DFEATURE_NAME=ON/OFF' through command-line.
dgl_feature_option(
BUILD_SPARSE
"Build DGL sparse library"
"all"
)
dgl_feature_option(
BUILD_TORCH
"Build the PyTorch plugin"
"all"
)
dgl_feature_option(
USE_EPOLL
"Build with epoll for socket communicator"
"all"
)
dgl_feature_option(
USE_LIBXSMM
"Build with LIBXSMM library optimization"
"all"
)
dgl_feature_option(
USE_OPENMP
"Build with OpenMP"
"all"
)

dgl_feature_option(
BUILD_GRAPHBOLT
"Build Graphbolt library"
"dev" "test"
)

dgl_feature_option(
LIBCXX_ENABLE_PARALLEL_ALGORITHMS
"Enable the parallel algorithms library. This requires the PSTL to be available."
"none"
)
dgl_feature_option(
REBUILD_LIBXSMM
"Clean LIBXSMM build cache at every build"
"none"
)
dgl_feature_option(
USE_HDFS
"Build with HDFS support"
"none"
) # Set env HADOOP_HDFS_HOME if needed
dgl_feature_option(
USE_S3
"Build with S3 support"
"none"
)

# Build cpp test only in test build.
dgl_feature_option(
BUILD_CPP_TEST
"Build cpp unittest executables"
"test"
)
endif()

# Set debug compile option for gdb, only happens when -DCMAKE_BUILD_TYPE=DEBUG
if (NOT MSVC)
Expand Down
21 changes: 21 additions & 0 deletions cmake/util/Util.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ macro(__dgl_option variable description value)
endif()
endmacro()

#######################################################
# An option to specify the build type for a feature.
# Usage:
# dgl_feature_option(<option_variable> "doc string" "dev" "release")
macro(dgl_feature_option variable description)
set(__value "")
foreach(arg ${ARGN})
if(arg STREQUAL "all")
__dgl_option(${variable} "${description}" ON)
elseif(arg STREQUAL "dev" OR arg STREQUAL "test" OR arg STREQUAL "release")
list(APPEND __value ${arg})
endif()
endforeach()

if(${BUILD_TYPE} IN_LIST __value)
__dgl_option(${variable} "${description}" ON)
else()
__dgl_option(${variable} "${description}" OFF)
endif()
endmacro()

#######################################################
# An option that the user can select. Can accept condition to control when option is available for user.
# Usage:
Expand Down
2 changes: 1 addition & 1 deletion script/build_dgl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [[ -z ${cuda} ]]; then
else
mkdir -p build
cd build
cmake -DUSE_CUDA=${cuda} ${extra_args} ..
cmake -DBUILD_TYPE=dev -DUSE_CUDA=${cuda} ${extra_args} ..
fi

if [[ ${PWD} == "${DGL_HOME}/build" ]]; then
Expand Down
5 changes: 1 addition & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ The code organization goes as follows:
Compile with unittest by executing the command below
```
# Assume current directory is the root directory of dgl, and googletest submodule is initialized
mkdir build
cd build
cmake .. -DBUILD_CPP_TEST=1
make -j${nproc}
bash script/build_dgl.sh -c -r -e '-DBUILD_TYPE=test'
./runUnitTests
```
2 changes: 1 addition & 1 deletion tests/scripts/build_dgl.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SET TEMP=%WORKSPACE%\tmp
SET TMPDIR=%WORKSPACE%\tmp

PUSHD build
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
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
msbuild dgl.sln /m /nr:false || EXIT /B 1
COPY /Y Release\runUnitTests.exe .
POPD
Expand Down
14 changes: 8 additions & 6 deletions tests/scripts/build_dgl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ if [ $# -ne 1 ]; then
exit -1
fi

CMAKE_VARS="-DBUILD_CPP_TEST=ON -DUSE_OPENMP=ON"
# Build for testing.
CMAKE_VARS="-DBUILD_TYPE=test"

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

# 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.
if [ "$1" != "cugraph" ]; then
# 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
CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=ON -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
CMAKE_VARS="$CMAKE_VARS -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
else
# Disable sparse build as cugraph docker image lacks cuDNN.
CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=OFF -DBUILD_SPARSE=OFF"
fi

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

if [ -d build ]; then
rm -rf build
fi
Expand Down

0 comments on commit d40a3c3

Please sign in to comment.