From aa0078020ac83e5ecb81982b89ef94ee8fa4cb65 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Thu, 12 Sep 2024 09:50:45 -0700 Subject: [PATCH] faiss: 1.8.0 -> 1.9.0 --- .../libraries/science/math/faiss/default.nix | 60 +++---------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/pkgs/development/libraries/science/math/faiss/default.nix b/pkgs/development/libraries/science/math/faiss/default.nix index a8e697132e903..b5c0f5451c23b 100644 --- a/pkgs/development/libraries/science/math/faiss/default.nix +++ b/pkgs/development/libraries/science/math/faiss/default.nix @@ -21,13 +21,11 @@ in # Choose the maximum available optimization level builtins.head optLevels, - faiss, # To run demos in the tests - runCommand, }@inputs: let pname = "faiss"; - version = "1.8.0"; + version = "1.9.0"; inherit (cudaPackages) flags backendStdenv; @@ -46,27 +44,15 @@ in stdenv.mkDerivation { inherit pname version; - outputs = [ - "out" - "demos" - ] ++ lib.optionals pythonSupport [ "dist" ]; + outputs = [ "out" ] ++ lib.optionals pythonSupport [ "dist" ]; src = fetchFromGitHub { owner = "facebookresearch"; repo = pname; rev = "v${version}"; - hash = "sha256-nS8nhkNGGb2oAJKfr/MIAZjAwMxBGbNd16/CkEtv67I="; + hash = "sha256-P8TynU6jz5NbcWLdI7n4LX5Gdz0Ks72bmOzQ3LGjQCQ="; }; - # Remove the following substituteInPlace when updating - # to a release that contains change from PR - # https://github.com/facebookresearch/faiss/issues/3239 - # that fixes building faiss with swig 4.2.x - postPatch = '' - substituteInPlace faiss/python/swigfaiss.swig \ - --replace-fail '#ifdef SWIGWORDSIZE64' '#if (__SIZEOF_LONG__ == 8)' - ''; - nativeBuildInputs = [ cmake ] ++ lib.optionals cudaSupport [ @@ -99,13 +85,7 @@ stdenv.mkDerivation { (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) ]; - buildFlags = - [ "faiss" ] - # This is just a demo app used as a test. - # Disabled because linkage fails: - # https://github.com/facebookresearch/faiss/issues/3484 - ++ lib.optionals (!cudaSupport) [ "demo_ivfpq_indexing" ] - ++ lib.optionals pythonSupport [ "swigfaiss" ]; + buildFlags = [ "faiss" ] ++ lib.optionals pythonSupport [ "swigfaiss" ]; # pip wheel->pip install commands copied over from opencv4 @@ -114,32 +94,10 @@ stdenv.mkDerivation { python -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist .) ''; - postInstall = - '' - mkdir -p $demos/bin - if [[ "$buildInputs" == *demo_ivfpq_indexing* ]] ; then - cp ./demos/demo_ivfpq_indexing $demos/bin/ - fi - '' - + lib.optionalString pythonSupport '' - mkdir "$dist" - cp faiss/python/dist/*.whl "$dist/" - ''; - - passthru = { - inherit cudaSupport cudaPackages pythonSupport; - - tests = { - runDemos = - runCommand "${pname}-run-demos" { buildInputs = [ faiss.demos ]; } - # There are more demos, we run just the one that documentation mentions - '' - demo_ivfpq_indexing && touch $out - ''; - pythonFaiss = pythonPackages.faiss; - pytest = pythonPackages.faiss.tests.pytest; - }; - }; + postInstall = lib.optionalString pythonSupport '' + mkdir "$dist" + cp faiss/python/dist/*.whl "$dist/" + ''; meta = { description = "Library for efficient similarity search and clustering of dense vectors by Facebook Research"; @@ -148,7 +106,5 @@ stdenv.mkDerivation { license = lib.licenses.mit; platforms = lib.platforms.unix; maintainers = with lib.maintainers; [ SomeoneSerge ]; - # error: use of undeclared identifier 'SWIGTYPE_p_long' - broken = stdenv.hostPlatform.isDarwin; }; }