-
Notifications
You must be signed in to change notification settings - Fork 3.1k
How to build DGL from source for the NVIDIA 5070 Ti (CUDA 13) and Pytorch 2.10.0 #7917
Description
Hi everyone,
I have got DGL to build from source for the NVIDIA 5070 Ti and CUDA 13.0 with Pytorch 2.10.0. This comes with some help from ChatGPT and a lot of tinkering and refining and so I thought I would document this here for the benefit of anyone else following suit - I see many open issues here with similar requests with no replies.
Note:
- My end goal has been to get RFantibody that depends on DGL working so some of the choices I have made (such as turning off HugeCTR) are specifically targeted with this in mind. You may need to tinker some more for your use case.
- I have built this on Debian Stable.
- Deviations from DGL source:
a) Patches:
I have patched the following files :
Patch CMakeLists.txt in the root DGL folder with the following:
CMakeLists.txt.patch
Patch cmake/modules/CUDA.cmake with the following:
CUDA.cmake.patch
b) I am also using GKlib and METIS from their source repo and not the ones provided along with DGL - the CMakeLists.txt changes take care of that.
c) I have disabled the following files (by renaming them with a .disabled suffix) :
./src/graph/metis_partition.cc.disabled
./src/graph/transform/metis_partition_hetero.cc.disabled
- the above may no longer be necessary since we are building and installing Metis and Gklib from source. However, I haven't tested things with these enabled once I got things working. You can let me know your experience if you choose to keep these on :)
- Build Steps :
Having done the above, I basically followed the following steps 👍
- Followed https://www.dgl.ai/dgl_docs/install/index.html#install-from-source to create a conda environment for the GPU
- Activated environment
- Installed Pytorch with CUDA in this environment - pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu130
- Build and install GKLib shared library from source in /usr/local - https://github.com/KarypisLab/GKlib
make config shared=1 prefix=/usr/local - Build and install Metis shared library from source in /usr/local - https://github.com/KarypisLab/METIS.git
make config shared=1 prefix=/usr/local - Back in DGL source directory
- mkdir build && cd build
- cmake .. -DUSE_CUDA=ON -DUSE_OPENMP=ON -DBUILD_TORCH=ON -DUSE_METIS=ON -DBUILD_HUGECTR=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
- In build directory run make
- Then followed the DGL document to setup python
cd ~/code/dgl/python
pip install -e . - Added dgl/build to LD_LIBRARY_PATH in ~/.bashrc
- Test with python -c "import dgl"
Hope the above helps :)
Regards,
Jeetu