%global pkgvers 1 %global scdate0 20220801 %global schash0 2b8ece4c230a5f0f0a74bc6f48e28edfb6c1c95e %global branch0 master %global source0 https://github.com/tensor-compiler/taco %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %global vcu_maj 12 %global vcu_min 0 Name: taco Version: 0.1 Release: %{scdate0}.%{pkgvers}.git%{sshort0}.cu%{vcu_maj}_%{vcu_min}%{?dist} Summary: The Tensor Algebra Compiler License: MIT URL: http://tensor-compiler.org/ Patch0: taco-fixes.patch BuildRequires: git doxygen cmake python3-setuptools BuildRequires: python3-devel pybind11-devel %global have_cuda 1 %global have_cuda_gcc 1 %global gpu_target_arch "5.0+PTX;5.2;6.1;7.5;8.6;8.9;9.0" %bcond_without cuda %if %{without cuda} %global have_cuda 0 %endif %if %{have_cuda} %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} Requires: cuda-cudart-%{vcu_maj}-%{vcu_min} Requires: cuda-nvrtc-%{vcu_maj}-%{vcu_min} Requires: cuda-nvtx-%{vcu_maj}-%{vcu_min} %endif %global __cmake_in_source_build 1 %description The Tensor Algebra Compiler (taco) is a C++ library that computes tensor algebra expressions on sparse and dense tensors. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package python3 Summary: Python files for %{name} Requires: %{name} = %{version}-%{release} Requires: python3-numpy python3-tqdm python3-requests python3-portalocker opencv-python3 %description python3 This package contains python files for %{name}. %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 log --format=fuller %patch0 -p1 -b .fixes~ %build # external pybind11 sed -i '/find_package(Git/,/^endif()/d' CMakeLists.txt sed -i '/FATAL_ERROR.*GIT/d' CMakeLists.txt sed -i 's|add_subdirectory(pybind11)|find_package(pybind11)|g' python_bindings/CMakeLists.txt sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt # lib path sed -i 's|DESTINATION lib|DESTINATION %{_lib}|' src/CMakeLists.txt sed -i '/set(PY_INSTALL_PATH/d' python_bindings/CMakeLists.txt # build mkdir build pushd build %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_LIBDIR=%{_lib} \ -DCMAKE_CXX_FLAGS="%{optflags} -fPIC -Wno-narrowing -fopenmp" \ %if %{have_cuda_gcc} %if (0%{?fedora} > 34) || (0%{?rhel} > 8) -DCUDA=ON \ -DCUDA_HOST_COMPILER="%{_bindir}/cuda-gcc" \ -DCMAKE_CUDA_HOST_COMPILER="%{_bindir}/cuda-gcc" \ %endif %endif -DOPENMP=ON \ -DPYTHON=ON \ -DPY_INSTALL_PATH="%{python3_sitelib}/pytaco" make %{?_smp_mflags} popd %install rm -rf %{buildroot} pushd build make install DESTDIR=%{buildroot} popd %check exit 0 export LD_LIBRARY_PATH=%{_builddir}/%{name}/build/lib export TACO_NVCC="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc" %if %{have_cuda_gcc} export TACO_NVCCFLAGS="-ccbin /usr/bin/cuda-gcc" %endif pushd build/bin ./taco-test ./taco-tensor_times_vector popd %files %doc README.md %license LICENSE %{_bindir}/* %{_libdir}/lib*.so* %files devel %{_includedir}/* %files python3 %{python3_sitelib}/* %changelog * Fri Mar 29 2019 Balint Cristian - github upstream releases