%global pkgvers 0 %global scdate0 20241030 %global schash0 2c961cc308ade8a85b3aa10a550728ce3387f625 %global branch0 main %global source0 https://github.com/facebookresearch/faiss.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %global vcu_maj 12 %global vcu_min 6 Name: faiss Version: %(curl -s https://raw.githubusercontent.com/facebookresearch/faiss/main/CMakeLists.txt | grep VERSION | grep -v cmake | awk '{print $2}' | sed 's|.[a-z,A-Z]||') Release: %{scdate0}.%{pkgvers}.git%{sshort0}.cu%{vcu_maj}_%{vcu_min}%{?dist} Summary: Efficient similarity search and clustering License: MIT URL: https://github.com/facebookresearch/faiss BuildRequires: doxygen cmake gcc-c++ swig git BuildRequires: python3-setuptools python3-devel BuildRequires: python3-numpy openblas-devel openblas-openmp %global have_cuda 1 %global have_cuda_gcc 1 %ifarch aarch64 %global gpu_target_arch "50;52;53;60;61;62;70;75;80;86;90" %else %global gpu_target_arch "50;52;60;61;70;75;80;86;90" %endif %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} BuildRequires: libcublas-devel-%{vcu_maj}-%{vcu_min} BuildRequires: libcurand-devel-%{vcu_maj}-%{vcu_min} %endif %global __cmake_in_source_build 1 %description Faiss is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vectors of any size, up to ones that possibly do not fit in RAM. %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} %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 # fixes sed -i 's|cublas.h|cublas_v2.h|' c_api/gpu/DeviceUtils_c.h # cmake sed -i 's|3.23.1|3.20.2|' CMakeLists.txt # allow custom host compiler sed -i '/CMAKE_CUDA_HOST_COMPILER/d' CMakeLists.txt %if 0%{?rhel} sed -i '/-doxygen/d' faiss/python/CMakeLists.txt %endif %build mkdir build pushd build %global optflags %(echo %{optflags} -w -fpermissive) %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_LIBDIR=%{_lib} \ -DFAISS_OPT_LEVEL="generic" \ -DFAISS_ENABLE_PYTHON=ON \ -DFAISS_ENABLE_C_API=ON \ -DBUILD_TESTING=OFF \ -DBLAS_LIBRARIES="openblaso" \ %if %{have_cuda} -DFAISS_ENABLE_GPU=ON \ %if %{have_cuda_gcc} %if (0%{?fedora} > 34) || (0%{?rhel} > 8) -DCMAKE_CUDA_HOST_COMPILER="%{_bindir}/cuda-gcc" \ %endif %endif -DCMAKE_CUDA_FLAGS="--compiler-options -fPIC -Wno-deprecated-gpu-targets -allow-unsupported-compiler" \ -DCMAKE_CUDA_COMPILER="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/bin/nvcc" \ -DCMAKE_CUDA_ARCHITECTURES=%{gpu_target_arch} %else -DFAISS_ENABLE_GPU=OFF %endif make %{?_smp_mflags} popd %install pushd build make install DESTDIR=%{buildroot} popd pushd build/faiss/python %if 0%{?rhel} == 8 %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') %{__python3} setup.py install --root %{buildroot} --no-compile %else %{__python3} setup.py install --root %{buildroot} %endif popd install -m755 build/c_api/*_c.so %{buildroot}/%{_libdir}/ install -m755 build/faiss/python/libfaiss_python_callbacks.so %{buildroot}/%{_libdir}/ %files %doc README.md CONTRIBUTING.md %doc demos %doc tutorial # % {_bindir}/* %license LICENSE %exclude %{_libdir}/libfaiss_python_callbacks.so %{_libdir}/lib*.so* %files devel %{_includedir}/* %{_datadir}/* %files python3 %{python3_sitelib}/* %{_libdir}/libfaiss_python_callbacks.so %changelog * Fri Mar 29 2019 Balint Cristian - github upstream releases