Files
nixpkgs/pkgs/development/python-modules/causal-conv1d/default.nix
T
Ihar Hrachyshka 567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00

70 lines
1.4 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
ninja,
setuptools,
torch,
cudaPackages,
rocmPackages,
config,
cudaSupport ? config.cudaSupport,
which,
}:
buildPythonPackage rec {
pname = "causal-conv1d";
version = "1.5.2";
pyproject = true;
src = fetchFromGitHub {
owner = "Dao-AILab";
repo = "causal-conv1d";
tag = "v${version}";
hash = "sha256-B2I5QiJl0p5d1BeQcMbJBAYUb10HzqFd88QMM8Rerm0=";
};
build-system = [
ninja
setuptools
torch
];
nativeBuildInputs = [ which ];
buildInputs = (
lib.optionals cudaSupport (
with cudaPackages;
[
cuda_cudart # cuda_runtime.h, -lcudart
cuda_cccl
libcusparse # cusparse.h
libcusolver # cusolverDn.h
cuda_nvcc
libcublas
]
)
);
dependencies = [
torch
];
# pytest tests not enabled due to nvidia GPU dependency
pythonImportsCheck = [ "causal_conv1d" ];
env = {
CAUSAL_CONV1D_FORCE_BUILD = "TRUE";
}
// lib.optionalAttrs cudaSupport { CUDA_HOME = "${lib.getDev cudaPackages.cuda_nvcc}"; };
meta = {
description = "Causal depthwise conv1d in CUDA with a PyTorch interface";
homepage = "https://github.com/Dao-AILab/causal-conv1d";
license = lib.licenses.bsd3;
# The package requires CUDA or ROCm, the ROCm build hasn't
# been completed or tested, so broken if not using cuda.
broken = !cudaSupport;
};
}