diff options
-rw-r--r-- | .SRCINFO | 7 | ||||
-rw-r--r-- | PKGBUILD | 41 | ||||
-rw-r--r-- | compiler.patch | 12 |
3 files changed, 39 insertions, 21 deletions
@@ -1,5 +1,5 @@ pkgbase = faiss-cuda-git - pkgver = v1.6.1.r16.gb9914eb + pkgver = v1.6.1.r87.gc97f890 pkgrel = 1 url = https://github.com/facebookresearch/faiss arch = i686 @@ -10,11 +10,16 @@ pkgbase = faiss-cuda-git makedepends = python-numpy makedepends = swig makedepends = python-setuptools + makedepends = openmp + makedepends = gcc9 depends = blas depends = lapack depends = cuda + optdepends = intel-mkl source = faiss::git+https://github.com/facebookresearch/faiss.git + source = compiler.patch sha256sums = SKIP + sha256sums = 3739947d39ebffb2775607f135743cd30489aa12f41c14e3aec42fbe79822fd3 pkgname = faiss-cuda-git pkgdesc = A library for efficient similarity search and clustering of dense vectors, CUDA version. @@ -1,5 +1,5 @@ # Maintainer: otaj <jasek.ota@gmail.com> -# If you want to set only one GPU target compute capability, set _GPU_TARGET, otherwise leave it commented out and it will build default targets (35, 52, 60 and 61). You can also set multiple targets separated by space (bash array) +# If you want to set only one GPU target compute capability, set _GPU_TARGET, otherwise leave it commented out and it will build default targets (35, 52, 60 and 61). You can also set multiple targets separated by semicolon #_GPU_TARGET="75" _pkgname=faiss @@ -8,12 +8,15 @@ pkgname=('faiss-cuda-git' 'python-faiss-cuda-git') arch=('i686' 'x86_64') url="https://github.com/facebookresearch/faiss" license=('MIT') -pkgver=v1.6.1.r16.gb9914eb +pkgver=v1.6.1.r87.gc97f890 pkgrel=1 -source=(${_pkgname}::git+https://github.com/facebookresearch/faiss.git) -sha256sums=('SKIP') +source=(${_pkgname}::git+https://github.com/facebookresearch/faiss.git + 'compiler.patch') +sha256sums=('SKIP' + '3739947d39ebffb2775607f135743cd30489aa12f41c14e3aec42fbe79822fd3') depends=('blas' 'lapack' 'cuda') -makedepends=('git' 'python' 'python-numpy' 'swig' 'python-setuptools') +makedepends=('git' 'python' 'python-numpy' 'swig' 'python-setuptools' 'openmp' 'gcc9') +optdepends=('intel-mkl') pkgver() { @@ -24,33 +27,30 @@ pkgver() { prepare() { cd "${srcdir}/${_pkgname}" - rm -f gpu/impl/{PQScanMultiPassNoPrecomputed.cu,gpu/impl/PQCodeDistances.cu} - _CONF_FLAGS='--prefix=/usr --with-cuda=/opt/cuda' + patch -p1 < ../compiler.patch + mkdir -p build + cd build + _CMAKE_FLAGS="-DFAISS_ENABLE_GPU=ON -DFAISS_ENABLE_PYTHON=ON -DCUDAToolkit_ROOT=/opt/cuda -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr " if ! [ -z "$_GPU_TARGET" ] then - _CONF_FLAGS=$_CONF_FLAGS" --with-cuda-arch=\"" - for _ARCH in ${_GPU_TARGET[@]} ; do - _CONF_FLAGS=$_CONF_FLAGS"-gencode=arch=compute_${_ARCH},code=sm_${_ARCH} " - done - _CONF_FLAGS=$_CONF_FLAGS'"' + $_CMAKE_FLAGS=$_CMAKE_FLAGS"-DCMAKE_CUDA_ARCHITECTURES=\""$_GPU_TARGET"\"" fi - sh -c "./configure $_CONF_FLAGS --with-python=python" - + cmake $_CMAKE_FLAGS .. } build() { - cd "${srcdir}/${_pkgname}" - make # build faiss - make -C python # build python package + cd "${srcdir}/${_pkgname}/build" + make } package_faiss-cuda-git() { pkgdesc='A library for efficient similarity search and clustering of dense vectors, CUDA version.' provides=('faiss') conflicts=('faiss') - cd "${srcdir}/${_pkgname}" + cd "${srcdir}/${_pkgname}/build" make DESTDIR="$pkgdir" install + cd .. install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } @@ -60,7 +60,8 @@ package_python-faiss-cuda-git() { conflicts=('python-faiss') depends=('python' 'python-numpy') - cd "${srcdir}/${_pkgname}/python" + cd "${srcdir}/${_pkgname}/build/faiss/python" python setup.py install --root="$pkgdir/" --optimize=1 --skip-build - install -Dm 644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + cd ../../.. + install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/compiler.patch b/compiler.patch new file mode 100644 index 000000000000..1c6cdf2ac663 --- /dev/null +++ b/compiler.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 29b73d8..f8899a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,6 @@ option(FAISS_ENABLE_GPU "Enable support for GPU indexes." ON) + option(FAISS_ENABLE_PYTHON "Build Python extension." ON) + + if(FAISS_ENABLE_GPU) +- set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER}) + enable_language(CUDA) + endif() + |