Unverified Commit 502f421f authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.gpu-rir: init at 0-unstable-2025-01-20 (#403598)

parents 70912233 f7a1a095
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  cmake,
  setuptools,

  # nativeBuildInputs
  autoAddDriverRunpath,
  cudaPackages,

  # dependencies
  numpy,
  scipy,
}:

buildPythonPackage {
  pname = "gpu-rir";
  version = "0-unstable-2025-01-20";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "DavidDiazGuerra";
    repo = "gpuRIR";
    rev = "fd8af43a4a113d3c2c05f0085a0119ecb1f1a484";
    hash = "sha256-nYi91iaNb9gswYzXW7aNpD3yYIgMvTen9r02G4d6joo=";
  };

  # Inject cmakeFlags in the cmake call
  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail \
        "cmake_args = [" \
        "cmake_args = os.environ.get('cmakeFlags', \"\").split() + ["
  '';

  build-system = [
    cmake
    setuptools
  ];
  dontUseCmakeConfigure = true;

  nativeBuildInputs = [
    autoAddDriverRunpath
    cudaPackages.cuda_nvcc
  ];

  # TODO: Investigate why (deprecated) FindCUDA fails to set these variables
  cmakeFlags = [
    (lib.cmakeFeature "CUDA_CUFFT_LIBARIES" "${lib.getLib cudaPackages.libcufft}/lib/libcufft.so")
    (lib.cmakeFeature "CUDA_curand_LIBRARY" "${lib.getLib cudaPackages.libcurand}/lib/libcurand.so")
  ];

  buildInputs = with cudaPackages; [
    cuda_cccl # <nv/target>
    cuda_cudart # cuda_runtime.h
    libcufft
    libcurand
  ];

  dependencies = [
    numpy
    scipy
  ];

  pythonImportsCheck = [ "gpuRIR" ];
  # Fails at import because there is no GPU access in the sandbox:
  # Check whether the following modules can be imported: gpuRIR
  # GPUassert: CUDA driver version is insufficient for CUDA runtime version /build/source/src/gpuRIR_cuda.cu 1037
  dontUsePythonImportsCheck = true;

  # No tests
  doCheck = false;

  meta = {
    description = "Python library for Room Impulse Response (RIR) simulation with GPU acceleration";
    homepage = "https://github.com/DavidDiazGuerra/gpuRIR";
    license = lib.licenses.agpl3Only;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -5914,6 +5914,8 @@ self: super: with self; {
  gptcache = callPackage ../development/python-modules/gptcache { };
  gpu-rir = callPackage ../development/python-modules/gpu-rir { };
  gpuctypes = callPackage ../development/python-modules/gpuctypes { };
  gpustat = callPackage ../development/python-modules/gpustat { };