Unverified Commit acb955e1 authored by Xin Yao's avatar Xin Yao Committed by GitHub
Browse files

[Cleanup] Cleanup unused CMake options (#5470)

* cleanup unused cmake options

* disable BUILD_TORCH for cugraph

* resolve comments
parent 866c70da
...@@ -33,6 +33,7 @@ dgl_option(USE_HDFS "Build with HDFS support" OFF) # Set env HADOOP_HDFS_HOME if ...@@ -33,6 +33,7 @@ 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(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(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(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(BUILD_SPARSE "Build DGL sparse library" ON)
dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3) dgl_option(TORCH_PYTHON_INTERPS "Python interpreter used to build tensoradapter and DGL sparse library" python3)
......
...@@ -11,11 +11,7 @@ pip install -r /asv/torch_gpu_pip.txt ...@@ -11,11 +11,7 @@ pip install -r /asv/torch_gpu_pip.txt
# 'CUDA_TOOLKIT_ROOT_DIR' is always required for sparse build as torch1.13.1+cu116 is installed. # 'CUDA_TOOLKIT_ROOT_DIR' is always required for sparse build as torch1.13.1+cu116 is installed.
CMAKE_VARS="-DUSE_OPENMP=ON -DBUILD_TORCH=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda" CMAKE_VARS="-DUSE_OPENMP=ON -DBUILD_TORCH=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda"
if [[ $DEVICE == "gpu" ]]; then if [[ $DEVICE == "gpu" ]]; then
CMAKE_VARS="-DUSE_CUDA=ON -DUSE_NCCL=ON $CMAKE_VARS" CMAKE_VARS="-DUSE_CUDA=ON $CMAKE_VARS"
fi
arch=`uname -m`
if [[ $arch == *"x86"* ]]; then
CMAKE_VARS="-DUSE_AVX=ON $CMAKE_VARS"
fi fi
mkdir -p build mkdir -p build
pushd build pushd build
......
...@@ -40,14 +40,11 @@ set(BUILD_CPP_TEST OFF) ...@@ -40,14 +40,11 @@ set(BUILD_CPP_TEST OFF)
# Whether to enable OpenMP. # Whether to enable OpenMP.
set(USE_OPENMP ON) set(USE_OPENMP ON)
# Whether to enable Intel's avx optimized kernel.
set(USE_AVX ON)
# Whether to build PyTorch plugins. # Whether to build PyTorch plugins.
set(BUILD_TORCH ON) set(BUILD_TORCH ON)
# Whether to enable CUDA kernels compiled with TVM. # Whether to enable CUDA kernels compiled with TVM.
set(USE_TVM OFF) set(USE_TVM OFF)
# Whether to enable fp16 to support mixed precision training. # Whether to build DGL sparse library.
set(USE_FP16 OFF) set(BUILD_SPARSE ON)
...@@ -5,28 +5,7 @@ ...@@ -5,28 +5,7 @@
:ref:`(English Version) <guide-mixed_precision>` :ref:`(English Version) <guide-mixed_precision>`
DGL mixed precision 학습을 위해서 `PyTorch's automatic mixed precision package <https://pytorch.org/docs/stable/amp.html>`_ 와 호환된다. 따라서, 학습 시간 및 GPU 메모리 사용량을 절약할 수 있다. 이 기능을 활성화하기 위해서는, PyTorch 1.6+, python 3.7+을 설치하고, ``float16`` 데이터 타입 지원을 위해서 DGL을 소스 파일을 사용해서 빌드해야 한다. (이 기능은 아직 베타 단계이고, pre-built pip wheel 형태로 제공하지 않는다.) DGL mixed precision 학습을 위해서 `PyTorch's automatic mixed precision package <https://pytorch.org/docs/stable/amp.html>`_ 와 호환된다. 따라서, 학습 시간 및 GPU 메모리 사용량을 절약할 수 있다.
설치
---------
우선 DGL 소스 코드를 GitHub에서 다운로드하고, ``USE_FP16=ON`` 플래그를 사용해서 shared library를 빌드한다.
.. code:: bash
git clone --recurse-submodules https://github.com/dmlc/dgl.git
cd dgl
mkdir build
cd build
cmake -DUSE_CUDA=ON -DUSE_FP16=ON ..
make -j
다음으로 Python 바인딩을 설치한다.
.. code:: bash
cd ../python
python setup.py install
Half precision을 사용한 메시지 전달 Half precision을 사용한 메시지 전달
------------------------------ ------------------------------
......
...@@ -115,7 +115,7 @@ install the Python binding for DGL. ...@@ -115,7 +115,7 @@ install the Python binding for DGL.
mkdir build mkdir build
cd build cd build
cmake -DUSE_OPENMP=off -DCMAKE_C_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DCMAKE_CXX_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DUSE_AVX=OFF -DUSE_LIBXSMM=OFF .. cmake -DUSE_OPENMP=off -DCMAKE_C_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DCMAKE_CXX_FLAGS='-DXBYAK_DONT_USE_MAP_JIT' -DUSE_LIBXSMM=OFF ..
make -j4 make -j4
cd ../python cd ../python
python setup.py install python setup.py install
......
...@@ -10,7 +10,7 @@ examples: ...@@ -10,7 +10,7 @@ examples:
Start a CUDA build: bash $0 -g Start a CUDA build: bash $0 -g
Build incrementally: bash $0 Build incrementally: bash $0
Remove all intermediate output and restart a CPU only build: bash $0 -c -r Remove all intermediate output and restart a CPU only build: bash $0 -c -r
Build with extra cmake arguments: bash $0 -c -e '-DUSE_AVX=ON' Build with extra cmake arguments: bash $0 -c -e '-DBUILD_TORCH=ON'
Build DGL. By default, build incrementally on top of the current state. Build DGL. By default, build incrementally on top of the current state.
......
...@@ -13,7 +13,7 @@ SET TEMP=%WORKSPACE%\tmp ...@@ -13,7 +13,7 @@ SET TEMP=%WORKSPACE%\tmp
SET TMPDIR=%WORKSPACE%\tmp SET TMPDIR=%WORKSPACE%\tmp
PUSHD build PUSHD build
cmake -DCMAKE_CXX_FLAGS="/DDGL_EXPORTS" -DUSE_AVX=ON -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 -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
msbuild dgl.sln /m /nr:false || EXIT /B 1 msbuild dgl.sln /m /nr:false || EXIT /B 1
COPY /Y Release\runUnitTests.exe . COPY /Y Release\runUnitTests.exe .
POPD POPD
......
...@@ -18,13 +18,7 @@ if [ "$1" != "cugraph" ]; then ...@@ -18,13 +18,7 @@ if [ "$1" != "cugraph" ]; then
CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=ON -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python" CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=ON -DTORCH_PYTHON_INTERPS=/opt/conda/envs/pytorch-ci/bin/python"
else else
# Disable sparse build as cugraph docker image lacks cuDNN. # Disable sparse build as cugraph docker image lacks cuDNN.
CMAKE_VARS="$CMAKE_VARS -DBUILD_SPARSE=OFF" CMAKE_VARS="$CMAKE_VARS -DBUILD_TORCH=OFF -DBUILD_SPARSE=OFF"
fi
#This is implemented to detect underlying architecture and enable arch specific optimization.
arch=`uname -m`
if [[ $arch == *"x86"* ]]; then
CMAKE_VARS="-DUSE_AVX=ON $CMAKE_VARS"
fi fi
if [[ $1 != "cpu" ]]; then if [[ $1 != "cpu" ]]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment