%global pkgvers 0 %global scdate0 20240313 %global schash0 a272efed96f0a42241235922236519ad8d0ba895 %global branch0 master %global source0 https://github.com/dmlc/dgl.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %global vcu_maj 12 %global vcu_min 3 %define ext_xsmm 0 %define have_torch 0 Name: dgl Version: 2.1.0 Release: %{scdate0}.%{pkgvers}.git%{sshort0}.cu%{vcu_maj}_%{vcu_min}%{?dist} Summary: Deep Graph Library License: Apache URL: https://github.com/dmlc/dgl Patch0: dgl-cuda.patch BuildRequires: doxygen cmake git gcc-c++ python3-setuptools pcre2-devel BuildRequires: python3-devel dlpack-devel dmlc-core-devel xbyak-devel pcg-cpp-devel BuildRequires: gtest-devel metis-devel gklib-devel python3-Cython tensorpipe-devel %if %{ext_xsmm} %ifarch x86_64 aarch64 BuildRequires: libxsmm-devel >= 1.17 %endif %endif %if %{have_torch} BuildRequires: pytorch-devel %endif %define have_cuda 1 %define have_cuda_gcc 1 %define gpu_target_arch "5.2+PTX 6.1 7.5 8.6 8.9 9.0" %bcond_without cuda %if %{without cuda} %define have_cuda 0 %endif %if %{have_cuda} %if 0%{?fedora} || (0%{?rhel} > 8) %if %{have_cuda_gcc} BuildRequires: cuda-gcc-c++ %endif %endif BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcusparse-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libnccl libnccl-devel Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} Requires: libcublas-%{vcu_maj}-%{vcu_min} Requires: libcurand-%{vcu_maj}-%{vcu_min} Requires: libcusparse-%{vcu_maj}-%{vcu_min} %endif Requires: dgl-python3 %global _default_patch_fuzz 100 %global __cmake_in_source_build 1 %description DGL is an easy-to-use, high performance and scalable Python package for deep learning on graphs. %package python3 Summary: Python files for xgboost Requires: %{name} = %{version}-%{release} %description python3 This package contains python files for xgboost. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git submodule update --init --depth 1 third_party/phmap git submodule update --init --depth 1 third_party/dlpack git submodule update --init --depth 1 third_party/nanoflann git submodule update --init --depth 1 third_party/liburing %if ! %{ext_xsmm} git submodule update --init --depth 1 third_party/libxsmm %endif #git submodule update --init --depth 1 --recursive third_party/thrust git log --format=fuller %patch -P 0 -p1 -b .cuda~ # external deps rm -rf third_party/tvm rm -rf third_party/nccl rm -rf third_party/xbyak rm -rf third_party/METIS #rm -rf third_party/dlpack rm -rf third_party/thrust/cub rm -rf third_party/thrust %if %{ext_xsmm} rm -rf third_party/libxsmm %endif rm -rf third_party/dmlc-core rm -rf third_party/googletest # remove cuda host flags sed -i '/list(APPEND CUDA_NVCC_FLAGS "-Xcompiler" "${CXX_HOST_FLAGS}")/d' cmake/modules/CUDA.cmake %if %{ext_xsmm} # avx512 sed -i 's|LIBXSMM_X86_AVX512|LIBXSMM_X86_AVX512_SKX|g' src/array/cpu/spmm.h # externals sed -i 's|-DUSE_LIBXSMM|-DUSE_LIBXSMM -I%{_includedir}/utils -I%{_includedir}/libxsmm|g' CMakeLists.txt sed -i '/Compile LIBXSMM/,/^endif/d' CMakeLists.txt sed -i 's|dgl ${DGL_LINKER_LIBS}|dgl metis ${DGL_LINKER_LIBS}|g' CMakeLists.txt %ifarch x86_64 aarch64 sed -i 's|dgl metis ${DGL_LINKER_LIBS}|dgl metis xsmm ${DGL_LINKER_LIBS}|g' CMakeLists.txt %else sed -i '/libxsmm_cpuid.h/d' src/runtime/config.cc %endif %endif # failing torch find sed -i '/find_package(Torch/d' dgl_sparse/CMakeLists.txt #gcc13 sed -i '1i #include ' src/runtime/dlpack_convert.cc sed -i '1i #include ' src/array/cuda/csr_transpose.cc # cython3 %if 0%{?fedora} sed -i 's|_c_dlpack_deleter(object pycaps):|_c_dlpack_deleter(object pycaps) noexcept:|' python/dgl/_ffi/_cython/ndarray.pxi %endif %build mkdir build pushd build export TORCH_CUDA_ARCH_LIST=%{gpu_target_arch} export TORCH_NVCC_FLAGS="-DCUDA_HAS_FP16 --compiler-options -fPIC -allow-unsupported-compiler" %if 0%{?fedora} || (0%{?rhel} > 8) %if %{have_cuda_gcc} export TORCH_NVCC_FLAGS="$TORCH_NVCC_FLAGS -ccbin=%{_bindir}/cuda-g++" %endif %endif export CUDA_SDK_ROOT_DIR="/usr/local/cuda-%{vcu_maj}.%{vcu_min}" %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_STANDARD=17 \ -DEXTERNAL_METIS_PATH=%{_prefix} \ -DEXTERNAL_METIS_LIB_PATH=%{_libdir} \ -DEXTERNAL_DLPACK_PATH=%{_prefix} \ -DEXTERNAL_DMLC_PATH=%{_prefix} \ -DEXTERNAL_DMLC_LIB_PATH=%{_libdir} \ -DEXTERNAL_GKLIB_PATH=%{_prefix} \ %ifarch x86_64 aarch64 -DUSE_LIBXSMM=ON \ %else -DUSE_LIBXSMM=OFF \ %endif %if %{have_torch} -DBUILD_TORCH=ON \ -DBUILD_SPARSE=ON \ -DBUILD_GRAPHBOLT=ON \ %else -DBUILD_TORCH=OFF \ -DBUILD_SPARSE=OFF \ -DBUILD_GRAPHBOLT=OFF \ %endif %if %{have_cuda} -DUSE_CUDA=ON \ -DCUDA_PROPAGATE_HOST_FLAGS=OFF \ -DCUDA_ARCH_NAME="Manual" \ -DCUDA_ARCH_BIN=%{gpu_target_arch} \ %if 0%{?fedora} || (0%{?rhel} > 8) %if %{have_cuda_gcc} -DCUDA_HOST_COMPILER="%{_bindir}/cuda-g++" \ %endif %endif -DCUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-%{vcu_maj}.%{vcu_min}" \ -DCUDA_NVCC_FLAGS="--compiler-options -fPIC -Wno-deprecated-gpu-targets -allow-unsupported-compiler" \ %else -DUSE_CUDA=OFF \ %endif -DUSE_OPENMP=ON \ -DGOOGLE_TEST=OFF \ -DBUILD_CPP_TEST=OFF make %{?_smp_mflags} popd pushd python %py3_build popd %install # build pushd build make install DESTDIR=%{buildroot} popd # python pushd python %py3_install popd # remove spurious rm -rf %{buildroot}/usr/dgl %files %license LICENSE %doc README.md CONTRIBUTORS.md %{_libdir}/lib*.so* %files python3 %{python3_sitearch}/* %changelog * Fri Dec 03 2021 Balint Cristian - github update releases