Skip to content

Commit

Permalink
Merge branch 'dmlc:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DuoLife-QNL authored Jan 14, 2023
2 parents 5c50d70 + acc567a commit 520f41f
Show file tree
Hide file tree
Showing 800 changed files with 49,189 additions and 65,125 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Lint

on: [pull_request]

jobs:
lintrunner:
runs-on: ubuntu-latest
steps:
- name: Pull DGL
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Checkout master and HEAD
run: |
git checkout -t origin/master
git checkout ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install lintrunner --user
- name: Initialize lint dependencies
run: lintrunner init

- name: Run lintrunner on all changed files
run: |
set +e
if ! lintrunner --force-color -m master --tee-json=lint.json; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`.\e[0m"
echo -e "\e[1m\e[36mSee https://github.com/pytorch/pytorch/wiki/lintrunner for setup instructions.\e[0m"
exit 1
fi
- name: Store annotations
if: always() && github.event_name == 'pull_request'
# Don't show this as an error; the above step will have already failed.
continue-on-error: true
run: |
# Use jq to massage the JSON lint output into GitHub Actions workflow commands.
jq --raw-output \
'"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \
lint.json
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
[submodule "third_party/thrust"]
path = third_party/thrust
url = https://github.com/NVIDIA/thrust.git
[submodule "third_party/pcg"]
path = third_party/pcg
url = https://github.com/imneme/pcg-cpp.git
56 changes: 56 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Black + usort
[[linter]]
code = 'UFMT'
include_patterns = [
'**/*.py',
]
command = [
'python3',
'tests/lint/ufmt_linter.py',
'--',
'@{{PATHSFILE}}'
]
exclude_patterns = [
'.github/*',
'build/*',
'cmake/*',
'conda/*',
'docker/*',
'third_party/*',
]
init_command = [
'python3',
'tests/lint/pip_init.py',
'--dry-run={{DRYRUN}}',
'black==22.10.0',
'ufmt==2.0.1',
'usort==1.0.5',
]
is_formatter = true

[[linter]]
code = 'CLANGFORMAT'
include_patterns = [
'**/*.h',
'**/*.c',
'**/*.cc',
'**/*.cpp',
'**/*.cuh',
'**/*.cu',
]
exclude_patterns = [
]
init_command = [
'python3',
'tests/lint/pip_init.py',
'--dry-run={{DRYRUN}}',
'clang-format==15.0.4',
]
command = [
'python3',
'tests/lint/clangformat_linter.py',
'--binary=clang-format',
'--',
'@{{PATHSFILE}}'
]
is_formatter = true
63 changes: 54 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dgl_option(USE_SYSTEM_NCCL "Build using system's NCCL library" OFF)
dgl_option(USE_OPENMP "Build with OpenMP" ON)
dgl_option(USE_AVX "Build with AVX optimization" OFF)
dgl_option(USE_LIBXSMM "Build with LIBXSMM library optimization" ON)
dgl_option(USE_FP16 "Build with fp16 support to enable mixed precision training" OFF)
dgl_option(USE_TVM "Build with TVM kernels" OFF)
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)
Expand All @@ -37,6 +36,8 @@ dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if
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_SPARSE "Build DGL sparse library" OFF)
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)

# Set debug compile option for gdb, only happens when -DCMAKE_BUILD_TYPE=DEBUG
if (NOT MSVC)
Expand Down Expand Up @@ -127,13 +128,6 @@ if ((NOT MSVC) AND USE_EPOLL)
endif()
endif ()

# Build with fp16 to support mixed precision training.
if(USE_FP16)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_FP16")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_FP16")
message(STATUS "Build with fp16 to support mixed precision training")
endif(USE_FP16)

# To compile METIS correct for DGL.
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DIDXTYPEWIDTH=64 /DREALTYPEWIDTH=32")
Expand Down Expand Up @@ -212,7 +206,7 @@ target_include_directories(dgl PRIVATE "third_party/METIS/include/")
target_include_directories(dgl PRIVATE "tensoradapter/include")
target_include_directories(dgl PRIVATE "third_party/nanoflann/include")
target_include_directories(dgl PRIVATE "third_party/libxsmm/include")

target_include_directories(dgl PRIVATE "third_party/pcg/include")

# For serialization
if (USE_HDFS)
Expand Down Expand Up @@ -259,6 +253,11 @@ if(NOT MSVC)
target_include_directories(dgl PRIVATE third_party/tensorpipe)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# Avoid exposing third-party symbols when using DGL as a library.
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--exclude-libs,ALL")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
endif()
endif(NOT MSVC)

# Compile TVM Runtime and Featgraph
Expand Down Expand Up @@ -338,6 +337,7 @@ if(BUILD_CPP_TEST)
include_directories("third_party/dmlc-core/include")
include_directories("third_party/phmap")
include_directories("third_party/libxsmm/include")
include_directories("third_party/pcg/include")
file(GLOB_RECURSE TEST_SRC_FILES ${PROJECT_SOURCE_DIR}/tests/cpp/*.cc)
add_executable(runUnitTests ${TEST_SRC_FILES})
target_link_libraries(runUnitTests gtest gtest_main)
Expand All @@ -354,3 +354,48 @@ if(BUILD_CPP_TEST)
target_link_libraries(rpc_server dgl)
endif(NOT MSVC)
endif(BUILD_CPP_TEST)

if(BUILD_SPARSE)
message(STATUS "Configuring DGL sparse library")
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} BINDIR)
file(TO_NATIVE_PATH ${CMAKE_COMMAND} CMAKE_CMD)
get_target_property(DGL_INCLUDE_DIRS dgl INCLUDE_DIRECTORIES)
message(STATUS "DGL include directories: ${DGL_INCLUDE_DIRS}")
message(STATUS "DGL link directories: ${DGL_INCLUDE_DIRS}")
if(MSVC)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dgl_sparse/build.bat BUILD_SCRIPT)
add_custom_target(
dgl_sparse
ALL
${CMAKE_COMMAND} -E env
CMAKE_COMMAND=${CMAKE_CMD}
CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}
USE_CUDA=${USE_CUDA}
BINDIR=${BINDIR}
INCLUDEDIR="${DGL_INCLUDE_DIRS}"
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS}
cmd /e:on /c ${BUILD_SCRIPT} ${TORCH_PYTHON_INTERPS}
DEPENDS ${BUILD_SCRIPT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dgl_sparse)
else(MSVC)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dgl_sparse/build.sh BUILD_SCRIPT)
add_custom_target(
dgl_sparse
ALL
${CMAKE_COMMAND} -E env
CMAKE_COMMAND=${CMAKE_CMD}
CUDA_TOOLKIT_ROOT_DIR=${CUDA_TOOLKIT_ROOT_DIR}
USE_CUDA=${USE_CUDA}
BINDIR=${CMAKE_CURRENT_BINARY_DIR}
INCLUDEDIR="${DGL_INCLUDE_DIRS}"
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS}
bash ${BUILD_SCRIPT} ${TORCH_PYTHON_INTERPS}
DEPENDS ${BUILD_SCRIPT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dgl_sparse)
endif(MSVC)
add_dependencies(dgl_sparse dgl)
endif(BUILD_SPARSE)
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ Contributors
* [Jiahui Liu](https://github.com/paoxiaode) from Nvidia
* [Neil Dickson](https://github.com/ndickson-nvidia) from Nvidia
* [Chang Liu](https://github.com/chang-l) from Nvidia
* [Muhammed Fatih Balin](https://github.com/mfbalin) from Nvidia and Georgia Tech
Loading

0 comments on commit 520f41f

Please sign in to comment.