Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suitesparse: use cuda stdenv if enabled #375482

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkgs/development/libraries/science/math/suitesparse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
openmp ? null,
}:

stdenv.mkDerivation rec {
let
stdenv' = if enableCuda then cudaPackages.backendStdenv else stdenv;
in
stdenv'.mkDerivation rec {
pname = "suitesparse";
version = "5.13.0";

Expand All @@ -35,7 +38,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs =
[
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
++ lib.optionals stdenv'.hostPlatform.isDarwin [
fixDarwinDylibNames
]
++ lib.optionals enableCuda [
Expand All @@ -53,7 +56,7 @@ stdenv.mkDerivation rec {
gmp
mpfr
]
++ lib.optionals stdenv.cc.isClang [
++ lib.optionals stdenv'.cc.isClang [
openmp
]
++ lib.optionals enableCuda [
Expand Down Expand Up @@ -82,14 +85,14 @@ stdenv.mkDerivation rec {
"CUDART_LIB=${lib.getLib cudaPackages.cuda_cudart}/lib/libcudart.so"
"CUBLAS_LIB=${lib.getLib cudaPackages.libcublas}/lib/libcublas.so"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
++ lib.optionals stdenv'.hostPlatform.isDarwin [
# Unless these are set, the build will attempt to use `Accelerate` on darwin, see:
# https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v5.13.0/SuiteSparse_config/SuiteSparse_config.mk#L368
"BLAS=-lblas"
"LAPACK=-llapack"
];

env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
env = lib.optionalAttrs stdenv'.hostPlatform.isDarwin {
# Ensure that there is enough space for the `fixDarwinDylibNames` hook to
# update the install names of the output dylibs.
NIX_LDFLAGS = "-headerpad_max_install_names";
Expand Down