faiss: use the split cudaPackages

...still transitively relies on cudatoolkit (through nvidia-thrust)
This commit is contained in:
Someone Serge 2022-04-12 17:41:36 +03:00
parent a0920575b4
commit 6087a4301c
No known key found for this signature in database
GPG key ID: 7B0E3B1390D61DA4
2 changed files with 27 additions and 2 deletions

View file

@ -1,13 +1,16 @@
{ lib
, config
, fetchFromGitHub
, symlinkJoin
, stdenv
, cmake
, cudaPackages ? { }
, cudaSupport ? config.cudaSupport or false
, pythonSupport ? true
, nvidia-thrust
, pythonPackages
, llvmPackages
, boost
, blas
, swig
, addOpenGLRunpath
@ -23,11 +26,24 @@
, runCommand
}:
assert cudaSupport -> nvidia-thrust.cudaSupport;
let
pname = "faiss";
version = "1.7.2";
inherit (cudaPackages) cudatoolkit cudaFlags;
inherit (cudaPackages) cudaFlags;
inherit (cudaFlags) cudaCapabilities dropDot;
cudaJoined = symlinkJoin {
name = "cuda-packages-unsplit";
paths = with cudaPackages; [
cuda_cudart # cuda_runtime.h
libcublas
libcurand
cuda_nvprof # cuda_profiler_api.h
];
};
in
stdenv.mkDerivation {
inherit pname version;
@ -50,6 +66,9 @@ stdenv.mkDerivation {
pythonPackages.wheel
] ++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
] ++ lib.optionals cudaSupport [
cudaJoined
nvidia-thrust
];
propagatedBuildInputs = lib.optionals pythonSupport [
@ -57,7 +76,7 @@ stdenv.mkDerivation {
];
nativeBuildInputs = [ cmake ] ++ lib.optionals cudaSupport [
cudatoolkit
cudaPackages.cuda_nvcc
addOpenGLRunpath
] ++ lib.optionals pythonSupport [
pythonPackages.python
@ -73,6 +92,7 @@ stdenv.mkDerivation {
"-DFAISS_OPT_LEVEL=${optLevel}"
] ++ lib.optionals cudaSupport [
"-DCMAKE_CUDA_ARCHITECTURES=${builtins.concatStringsSep ";" (map dropDot cudaCapabilities)}"
"-DCUDAToolkit_INCLUDE_DIR=${cudaJoined}/include"
];

View file

@ -37804,6 +37804,11 @@ with pkgs;
swig = swig4;
};
faissWithCuda = faiss.override {
cudaSupport = true;
nvidia-thrust = nvidia-thrust-cuda;
};
fityk = callPackage ../applications/science/misc/fityk { };
galario = callPackage ../development/libraries/galario { };