Skip to content

Commit

Permalink
tiny-cuda-nn: fix a couple of build issues (#359664)
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorBaker authored Dec 5, 2024
2 parents 8436552 + 4f6eafb commit 833953e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkgs/by-name/ti/tiny-cuda-nn/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
which,
}: let
inherit (lib) lists strings;
inherit (cudaPackages) backendStdenv flags;
inherit (cudaPackages) backendStdenv cudaVersion flags;

cuda-common-redist = with cudaPackages; [
(lib.getDev cuda_cudart) # cuda_runtime.h
Expand All @@ -36,6 +36,14 @@
name = "cuda-redist";
paths = cuda-common-redist;
};

unsupportedCudaCapabilities = [
"9.0a"
];

cudaCapabilities = lists.subtractLists unsupportedCudaCapabilities flags.cudaCapabilities;

cudaArchitecturesString = strings.concatMapStringsSep ";" flags.dropDot cudaCapabilities;
in
stdenv.mkDerivation (finalAttrs: {
pname = "tiny-cuda-nn";
Expand All @@ -52,6 +60,13 @@ in
hash = "sha256-qW6Fk2GB71fvZSsfu+mykabSxEKvaikZ/pQQZUycOy0=";
};

# Remove this once a release is made with
# https://github.com/NVlabs/tiny-cuda-nn/commit/78a14fe8c292a69f54e6d0d47a09f52b777127e1
postPatch = lib.optionals (strings.versionAtLeast cudaVersion "11.0") ''
substituteInPlace bindings/torch/setup.py --replace-fail \
"-std=c++14" "-std=c++17"
'';

nativeBuildInputs =
[
cmake
Expand Down Expand Up @@ -89,7 +104,7 @@ in
doCheck = false;

preConfigure = ''
export TCNN_CUDA_ARCHITECTURES="${flags.cmakeCudaArchitecturesString}"
export TCNN_CUDA_ARCHITECTURES="${cudaArchitecturesString}"
export CUDA_HOME="${cuda-native-redist}"
export LIBRARY_PATH="${cuda-native-redist}/lib/stubs:$LIBRARY_PATH"
export CC="${backendStdenv.cc}/bin/cc"
Expand Down

0 comments on commit 833953e

Please sign in to comment.