Skip to content

Commit

Permalink
Merge pull request #301416 from ConnorBaker/feat/cudaPackages-lessons…
Browse files Browse the repository at this point in the history
…-learned-from-cross-compilation-attempt

cuda-modules: apply lessons learned from cross-compilation attempts
  • Loading branch information
Connor Baker authored Apr 19, 2024
2 parents caaff6c + 6208368 commit c66994c
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 275 deletions.
4 changes: 1 addition & 3 deletions pkgs/development/cuda-modules/backend-stdenv.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
cudaVersion,
lib,
nvccCompatibilities,
cudaVersion,
pkgs,
overrideCC,
stdenv,
wrapCCWith,
stdenvAdapters,
}:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ hostPlatform, lib }:
{ lib, stdenv }:
let
inherit (stdenv) hostPlatform;

# Samples are built around the CUDA Toolkit, which is not available for
# aarch64. Check for both CUDA version and platform.
platformIsSupported = hostPlatform.isx86_64 && hostPlatform.isLinux;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ in
# CUTENSOR_ROOT is double escaped
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "\''${CUTENSOR_ROOT}/include" "${cutensor.dev}/include"
--replace-fail "\''${CUTENSOR_ROOT}/include" "${cutensor.dev}/include"
'';

CUTENSOR_ROOT = cutensor;
Expand Down
4 changes: 3 additions & 1 deletion pkgs/development/cuda-modules/cuda-samples/extension.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
cudaVersion,
hostPlatform,
lib,
stdenv,
}:
let
cudaVersionToHash = {
Expand All @@ -23,6 +23,8 @@ let
"12.3" = "sha256-fjVp0G6uRCWxsfe+gOwWTN+esZfk0O5uxS623u0REAk=";
};

inherit (stdenv) hostPlatform;

# Samples are built around the CUDA Toolkit, which is not available for
# aarch64. Check for both CUDA version and platform.
cudaVersionIsSupported = cudaVersionToHash ? ${cudaVersion};
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/cuda-modules/cuda-samples/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
hash,
lib,
pkg-config,
stdenv,
}:
let
inherit (lib) lists strings;
Expand Down Expand Up @@ -63,7 +64,7 @@ backendStdenv.mkDerivation (finalAttrs: {
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin bin/${backendStdenv.hostPlatform.parsed.cpu.name}/${backendStdenv.hostPlatform.parsed.kernel.name}/release/*
install -Dm755 -t $out/bin bin/${stdenv.hostPlatform.parsed.cpu.name}/${stdenv.hostPlatform.parsed.kernel.name}/release/*
runHook postInstall
'';
Expand Down
Loading

0 comments on commit c66994c

Please sign in to comment.