2020-02-11 11:02:43 -08:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gfortran
|
2020-03-31 07:47:18 -07:00
|
|
|
, blas, lapack
|
2020-03-10 12:07:26 -07:00
|
|
|
, metis
|
2020-02-11 11:02:43 -08:00
|
|
|
, fixDarwinDylibNames
|
2019-01-01 06:47:55 -08:00
|
|
|
, gnum4
|
2020-02-11 11:02:43 -08:00
|
|
|
, enableCuda ? false
|
|
|
|
, cudatoolkit
|
2017-03-29 06:47:51 -07:00
|
|
|
}:
|
2014-12-15 09:29:30 -08:00
|
|
|
|
2020-02-11 11:02:43 -08:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "suitesparse";
|
2020-04-09 01:58:00 -07:00
|
|
|
version = "5.7.2";
|
2015-06-03 15:33:11 -07:00
|
|
|
|
2020-02-11 11:02:43 -08:00
|
|
|
outputs = [ "out" "dev" "doc" ];
|
2014-12-15 09:29:30 -08:00
|
|
|
|
2020-02-11 11:02:43 -08:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "DrTimothyAldenDavis";
|
|
|
|
repo = "SuiteSparse";
|
|
|
|
rev = "v${version}";
|
2020-04-09 01:58:00 -07:00
|
|
|
sha256 = "1imndff7yygjrbbrcscsmirdi8w0lkwj5dbhydxmf7lklwn4j3q6";
|
2014-12-15 09:29:30 -08:00
|
|
|
};
|
|
|
|
|
2020-02-11 11:02:43 -08:00
|
|
|
nativeBuildInputs = [
|
|
|
|
gnum4
|
|
|
|
] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-03-31 07:47:18 -07:00
|
|
|
blas lapack
|
2020-03-10 12:07:26 -07:00
|
|
|
metis
|
2020-02-11 11:02:43 -08:00
|
|
|
gfortran.cc.lib
|
|
|
|
] ++ stdenv.lib.optional enableCuda cudatoolkit;
|
|
|
|
|
2014-12-15 09:29:30 -08:00
|
|
|
preConfigure = ''
|
2020-03-10 12:19:24 -07:00
|
|
|
# Mongoose and GraphBLAS are packaged separately
|
|
|
|
sed -i "Makefile" -e '/GraphBLAS\|Mongoose/d'
|
2018-02-20 00:05:24 -08:00
|
|
|
'';
|
|
|
|
|
suitesparse: ultimate clean-up
* Switch to default buildPhase & installPhase
* In preConfigure
* Do not add -DNPARTITION to CHOLMOD_CONFIG. That would disable the use of Metis but we already have that.
* Do not remove -lrt on Darwin, Darwin compiler can handle that and the code no longer exists anyway.
* With CUDA enabled
* Do not replace CUDA_ROOT. It does not exist any more. Instead we are setting CUDA_PATH in makeFlags.
* Do not replace GPU_BLAS_PATH, it defaults to CUDA_PATH so it will end up with the same value.
* Do not add -DCHOLMOD_OMP_NUM_THREADS to GPU_CONFIG. Why would be having the library use the same number of threads as the builder a good idea?
* Do not replace CUDA_PATH, we are setting it in makeFlags now.
* Do not replace CUDART_LIB and CUBLAS_LIB. They were being replaced incorrectly (cuda libs are located in lib directory, not lib64). Instead set the correct paths in makeFlags.
* Do not replace CUDA_INC_PATH. Its default looks like it will end up with the same value.
* Do not replace NV20, NV30, NV35 – not used any more.
* Do not replace NVCC, defaults to the same.
* Do not replace NVCCFLAGS, we just used the default from SourceSparse 4.4.7 with -gencode=arch=compute_60,code=compute_60 tacked on top. Current upstream default looks much better.
* Stop adding -DNTIMER to CFLAGS on Darwin – clock_gettime is supported by macOS 10.12 SDK.
* In buildPhase
* Move the make arguments to makeFlags and library to buildFlags, allowing us to drop the manual make call. I did not verify all of these are still needed.
* Remove the creation of libsuitesparse.so. As far as I could tell it is some kind of remnant of our old expression – perhaps due to past deficiencies of the build scripts, we created the individual libraries as symlinks to libsuitesparse.so: https://github.com/NixOS/nixpkgs/commit/e36b3ec0a56c3b06152a205a46804733b88695d6 But since the build script can now build individual .so libraries, there should be no need for this abomination. No other distros do this either.
* In installPhase
* No need to copy things manually, there is an install target. We just need to pass INSTALL=$out flag to make to let it know where to install the files.
* I do not have means of verifying the darwin dylib name fix but it looks like it might be fixed in an upcoming release.
* I dropped the rpath fixup as it does not seem to be needed any more (ldd does not report any unresolved libraries).
2020-03-10 19:24:33 -07:00
|
|
|
makeFlags = [
|
|
|
|
"INSTALL=${placeholder "out"}"
|
|
|
|
"INSTALL_INCLUDE=${placeholder "dev"}/include"
|
|
|
|
"JOBS=$(NIX_BUILD_CORES)"
|
2020-03-31 07:47:18 -07:00
|
|
|
"BLAS=-lblas"
|
|
|
|
"LAPACK=-llapack"
|
suitesparse: ultimate clean-up
* Switch to default buildPhase & installPhase
* In preConfigure
* Do not add -DNPARTITION to CHOLMOD_CONFIG. That would disable the use of Metis but we already have that.
* Do not remove -lrt on Darwin, Darwin compiler can handle that and the code no longer exists anyway.
* With CUDA enabled
* Do not replace CUDA_ROOT. It does not exist any more. Instead we are setting CUDA_PATH in makeFlags.
* Do not replace GPU_BLAS_PATH, it defaults to CUDA_PATH so it will end up with the same value.
* Do not add -DCHOLMOD_OMP_NUM_THREADS to GPU_CONFIG. Why would be having the library use the same number of threads as the builder a good idea?
* Do not replace CUDA_PATH, we are setting it in makeFlags now.
* Do not replace CUDART_LIB and CUBLAS_LIB. They were being replaced incorrectly (cuda libs are located in lib directory, not lib64). Instead set the correct paths in makeFlags.
* Do not replace CUDA_INC_PATH. Its default looks like it will end up with the same value.
* Do not replace NV20, NV30, NV35 – not used any more.
* Do not replace NVCC, defaults to the same.
* Do not replace NVCCFLAGS, we just used the default from SourceSparse 4.4.7 with -gencode=arch=compute_60,code=compute_60 tacked on top. Current upstream default looks much better.
* Stop adding -DNTIMER to CFLAGS on Darwin – clock_gettime is supported by macOS 10.12 SDK.
* In buildPhase
* Move the make arguments to makeFlags and library to buildFlags, allowing us to drop the manual make call. I did not verify all of these are still needed.
* Remove the creation of libsuitesparse.so. As far as I could tell it is some kind of remnant of our old expression – perhaps due to past deficiencies of the build scripts, we created the individual libraries as symlinks to libsuitesparse.so: https://github.com/NixOS/nixpkgs/commit/e36b3ec0a56c3b06152a205a46804733b88695d6 But since the build script can now build individual .so libraries, there should be no need for this abomination. No other distros do this either.
* In installPhase
* No need to copy things manually, there is an install target. We just need to pass INSTALL=$out flag to make to let it know where to install the files.
* I do not have means of verifying the darwin dylib name fix but it looks like it might be fixed in an upcoming release.
* I dropped the rpath fixup as it does not seem to be needed any more (ldd does not report any unresolved libraries).
2020-03-10 19:24:33 -07:00
|
|
|
"MY_METIS_LIB=-lmetis"
|
2020-04-20 13:50:55 -07:00
|
|
|
] ++ stdenv.lib.optionals blas.isILP64 [
|
suitesparse: ultimate clean-up
* Switch to default buildPhase & installPhase
* In preConfigure
* Do not add -DNPARTITION to CHOLMOD_CONFIG. That would disable the use of Metis but we already have that.
* Do not remove -lrt on Darwin, Darwin compiler can handle that and the code no longer exists anyway.
* With CUDA enabled
* Do not replace CUDA_ROOT. It does not exist any more. Instead we are setting CUDA_PATH in makeFlags.
* Do not replace GPU_BLAS_PATH, it defaults to CUDA_PATH so it will end up with the same value.
* Do not add -DCHOLMOD_OMP_NUM_THREADS to GPU_CONFIG. Why would be having the library use the same number of threads as the builder a good idea?
* Do not replace CUDA_PATH, we are setting it in makeFlags now.
* Do not replace CUDART_LIB and CUBLAS_LIB. They were being replaced incorrectly (cuda libs are located in lib directory, not lib64). Instead set the correct paths in makeFlags.
* Do not replace CUDA_INC_PATH. Its default looks like it will end up with the same value.
* Do not replace NV20, NV30, NV35 – not used any more.
* Do not replace NVCC, defaults to the same.
* Do not replace NVCCFLAGS, we just used the default from SourceSparse 4.4.7 with -gencode=arch=compute_60,code=compute_60 tacked on top. Current upstream default looks much better.
* Stop adding -DNTIMER to CFLAGS on Darwin – clock_gettime is supported by macOS 10.12 SDK.
* In buildPhase
* Move the make arguments to makeFlags and library to buildFlags, allowing us to drop the manual make call. I did not verify all of these are still needed.
* Remove the creation of libsuitesparse.so. As far as I could tell it is some kind of remnant of our old expression – perhaps due to past deficiencies of the build scripts, we created the individual libraries as symlinks to libsuitesparse.so: https://github.com/NixOS/nixpkgs/commit/e36b3ec0a56c3b06152a205a46804733b88695d6 But since the build script can now build individual .so libraries, there should be no need for this abomination. No other distros do this either.
* In installPhase
* No need to copy things manually, there is an install target. We just need to pass INSTALL=$out flag to make to let it know where to install the files.
* I do not have means of verifying the darwin dylib name fix but it looks like it might be fixed in an upcoming release.
* I dropped the rpath fixup as it does not seem to be needed any more (ldd does not report any unresolved libraries).
2020-03-10 19:24:33 -07:00
|
|
|
"CFLAGS=-DBLAS64"
|
|
|
|
] ++ stdenv.lib.optionals enableCuda [
|
|
|
|
"CUDA_PATH=${cudatoolkit}"
|
|
|
|
"CUDART_LIB=${cudatoolkit.lib}/lib/libcudart.so"
|
|
|
|
"CUBLAS_LIB=${cudatoolkit}/lib/libcublas.so"
|
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
# Build individual shared libraries, not demos
|
|
|
|
"library"
|
|
|
|
];
|
|
|
|
|
2014-12-15 09:29:30 -08:00
|
|
|
meta = with stdenv.lib; {
|
2020-02-11 11:02:43 -08:00
|
|
|
homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
|
2014-12-15 09:29:30 -08:00
|
|
|
description = "A suite of sparse matrix algorithms";
|
|
|
|
license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
|
|
|
|
maintainers = with maintainers; [ ttuegel ];
|
2016-08-02 10:50:55 -07:00
|
|
|
platforms = with platforms; unix;
|
2014-12-15 09:29:30 -08:00
|
|
|
};
|
|
|
|
}
|