%global pkgvers 0 %global scdate0 20241028 %global schash0 545aea48aeeaaa9e9abcdbcb90c59f6d6faac59c %global branch0 main %global source0 https://github.com/cupy/cupy.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %global vcu_maj 12 %global vcu_min 6 Name: cupy Summary: NumPy-like API accelerated with CUDA Version: %(curl -s https://raw.githubusercontent.com/cupy/cupy/%{schash0}/cupy/_version.py | cut -d"'" -f2 | sed 's|[^[:digit:].]||g') Release: %{scdate0}.%{pkgvers}.git%{sshort0}.cu%{vcu_maj}_%{vcu_min}%{?dist} License: MIT URL: https://cupy.dev Patch0: https://github.com/cupy/cupy/pull/8457.patch BuildRequires: gcc-c++ git python3-devel > 3.7 BuildRequires: python3-setuptools fastrlock-python3 dlpack-devel %if 0%{?fedora} > 39 BuildRequires: python3-Cython %else BuildRequires: ((python3dist(cython) > 0.23) with (python3dist(cython) < 3~~)) %endif %global have_cuda_gcc 1 %global _lto_cflags %{nil} %undefine _hardened_build %undefine _annotated_build %if %{_smp_build_ncpus} <= 4 %global _smp_mflags -j4 %endif %if %{have_cuda_gcc} %if (0%{?fedora} > 34) || (0%{?rhel} > 8) 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: cuda-profiler-api-%{vcu_maj}-%{vcu_min} BuildRequires: libcusolver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcusparse-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcufft-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} BuildRequires: nvidia-driver-cuda-libs BuildRequires: libnccl-devel BuildRequires: libcudnn8-devel BuildRequires: libcutensor-devel # % ifnarch ppc64le #BuildRequires: libcusparselt-devel #Requires: libcusparselt0 # % endif Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} Requires: libcusparse-%{vcu_maj}-%{vcu_min} Requires: libcusolver-%{vcu_maj}-%{vcu_min} Requires: libcublas-%{vcu_maj}-%{vcu_min} Requires: libcufft-%{vcu_maj}-%{vcu_min} Requires: libcurand-%{vcu_maj}-%{vcu_min} %global __cmake_in_source_build 1 %global _default_patch_fuzz 100 %description NumPy-like API accelerated with CUDA %package python3 Summary: Development files for python Requires: pkgconfig Provides: cupy %description python3 This package contains the python libraries. %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/cccl git submodule update --init --depth 1 third_party/jitify git submodule update --init --depth 1 third_party/dlpack git log --format=fuller %if 0%{?fedora} > 39 %patch -P 0 -p1 -b .cy3~ %endif %build # rise ulimit ulimit -Sn "$(ulimit -Hn)" # external cub sed -i '/preflight_check/,/exit/d' setup.py # no cuspareslt sed -i -e '/CUDA_cusparselt,/d' install/cupy_builder/_features.py rm -rf cupy_backends/cuda/cupy_cusparselt.h sed -i -e "s|--std=c++11|--std=c++14|g" install/cupy_builder/cupy_setup_build.py sed -i -e "s|--disable-new-dtags,|--disable-new-dtags|g" install/cupy_builder/cupy_setup_build.py sed -i -e "s|# see #1849|sysconfig._config_vars['CFLAGS']='%{optflags} -std=c++14'|g" install/cupy_builder/cupy_setup_build.py export CUDA_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}" export CUPY_NVCC_GENERATE_CODE="arch=compute_50,code=compute_50;arch=compute_52,code=sm_52;arch=compute_61,code=sm_61;arch=compute_75,code=sm_75;arch=compute_86,code=sm_86;arch=compute_89,code=sm_89;arch=compute_90,code=sm_90" export NVCC="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc -std=c++14 -Icupy/core/include/ -Wno-deprecated-gpu-targets -allow-unsupported-compiler" %if %{have_cuda_gcc} %if (0%{?fedora} > 34) || (0%{?rhel} > 8) export NVCC="$NVCC -ccbin %{_bindir}/cuda-g++" %endif %endif export LD_LIBRARY_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/%{_lib}/" %{__python3} setup.py build --cupy-no-rpath %{?_smp_mflags} %install export LD_LIBRARY_PATH="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/%{_lib}/" %{__python3} setup.py install -O1 --skip-build --root %{buildroot} %ldconfig_scriptlets %files python3 %license LICENSE %doc examples %doc README.md %{python3_sitearch}/* %changelog * Sun Jan 06 2019 Cristian Balint - github update releases