# DGL ## 安装 安装DGL,你需要 + dtk 22.10 + Python 3.9 其余版本需源码安装 ### 使用pip安装 dgl whl包下载目录:[https://cancon.hpccube.com:65024/4/main/dgl/dtk22.10](https://cancon.hpccube.com:65024/4/main/dgl/dtk22.10) ```shell pip install dgl* (下载的dgl的whl包) ``` ### 使用源码安装 #### 编译环境准备 ```shell pip install setuptools==59.5.0 wheel ``` #### 编译安装 ```shell git clone -b 0.9.1-dgl https://developer.hpccube.com/codes/aicomponent/dgl cd dgl mkdir build && cd build source $ROCM_PATH/env.sh cmake -DUSE_HIP=ON -DCMAKE_BUILD_TYPE=Release .. make -j16 cd ../python python setup.py bdist_wheel pip install dist/dgl* ``` ## 参考 - [README_ORIGIN](README_ORIGIN.md) ## 适配HIP移植修改 ```shell 1. cmake相关 修改CMakeLists.txt,增加USE_HIP编译控制 新增cmake/modules/ROCM.cmake,参考cmake/modules/CUDA.cmake进行编译配置 增加CUDART_VERSION相关宏参数 2. 源码修改 添加宏判断,设备上不支持iostream src/array/selector.h:34 hip结构体hipPointerAttribute_t适配 src/runtime/cuda/cuda_device_api.cc:251 添加显式基类限定词 src/runtime/cuda/cuda_hashtable.cu:60 src/runtime/cuda/cuda_hashtable.cu:104 src/runtime/cuda/cuda_hashtable.cu:110 添加对CUDART_VERSION相关的条件判断flag src/array/cuda/spmm_hetero.cu:59 src/array/cuda/spmm_hetero.cu:133 注释CUB_VERSION相关的static_assert检查 src/array/cuda/rowwise_sampling_prob.cu:20 注释CUDART_VERSION相关的static_assert检查 src/array/cuda/atomic.cuh:83 增加__HIPCC__宏定义的检查 include/dgl/array_iterator.h:9 ```