git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #64195 from flokli/scikits-odes

scikits-odes: init at 2.4.0

commita77fba2ef9011d11ddb11f834a01e50c6236060a authorFlorian Klink <flokli@flokli.de> dateSun 8 Sep 2019, 16:31 (7 years ago) parent462cdb9652448f
6 files changed+195−9
pkgs/development/libraries/sundials/3.x.nix+52 pkgs/development/libraries/sundials/default.nix+39−9 pkgs/development/libraries/sundials/tests-parallel.patch+45 pkgs/development/python-modules/scikits-odes/default.nix+55 pkgs/top-level/all-packages.nix+2 pkgs/top-level/python-packages.nix+2
pkgs/development/libraries/sundials/3.x.nixnew file+52
@@ -0,0 +1,52 @@
1+{ stdenv
2+, cmake
3+, fetchurl
4+, python
5+, liblapack
6+, gfortran
7+, lapackSupport ? true }:
8+
9+let liblapackShared = liblapack.override {
10+ shared = true;
11+};
12+
13+in stdenv.mkDerivation rec {
14+ pname = "sundials";
15+ version = "3.2.1";
16+
17+ buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ gfortran ];
18+ nativeBuildInputs = [ cmake ];
19+
20+ src = fetchurl {
21+ url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
22+ sha256 = "0238r1qnwqz13wcjzfsbcfi8rfnlxcjjmxq2vpf2qf5jgablvna7";
23+ };
24+
25+ patches = [
26+ (fetchurl {
27+ # https://github.com/LLNL/sundials/pull/19
28+ url = "https://github.com/LLNL/sundials/commit/1350421eab6c5ab479de5eccf6af2dcad1eddf30.patch";
29+ sha256 = "0g67lixp9m85fqpb9rzz1hl1z8ibdg0ldwq5z6flj5zl8a7cw52l";
30+ })
31+ ];
32+
33+ cmakeFlags = [
34+ "-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples"
35+ ] ++ stdenv.lib.optionals (lapackSupport) [
36+ "-DSUNDIALS_INDEX_TYPE=int32_t"
37+ "-DLAPACK_ENABLE=ON"
38+ "-DLAPACK_LIBRARIES=${liblapackShared}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary};${liblapackShared}/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
39+ ];
40+
41+ # flaky tests, and patch in https://github.com/LLNL/sundials/pull/21 doesn't apply cleanly for sundials_3
42+ doCheck = false;
43+ checkPhase = "make test";
44+
45+ meta = with stdenv.lib; {
46+ description = "Suite of nonlinear differential/algebraic equation solvers";
47+ homepage = https://computation.llnl.gov/projects/sundials;
48+ platforms = platforms.all;
49+ maintainers = with maintainers; [ flokli idontgetoutmuch ];
50+ license = licenses.bsd3;
51+ };
52+}
pkgs/development/libraries/sundials/default.nix+39−9
@@ -1,28 +1,58 @@
1−{ cmake, fetchurl, python, stdenv }:
1+{ stdenv
2+, cmake
3+, fetchurl
4+, python
5+, liblapack
6+, gfortran
7+, lapackSupport ? true }:
28
3−stdenv.mkDerivation rec {
9+let liblapackShared = liblapack.override {
10+ shared = true;
11+};
412
13+in stdenv.mkDerivation rec {
514 pname = "sundials";
615 version = "4.1.0";
716
17+ buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ gfortran ];
18+ nativeBuildInputs = [ cmake ];
19+
820 src = fetchurl {
921 url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
1022 sha256 = "19ca4nmlf6i9ijqcibyvpprxzsdfnackgjs6dw51fq13gg1f2398";
1123 };
1224
13− preConfigure = ''
14− export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$out -DEXAMPLES_INSTALL_PATH=$out/share/examples $cmakeFlags"
15− '';
25+ patches = [
26+ (fetchurl {
27+ # https://github.com/LLNL/sundials/pull/19
28+ url = "https://github.com/LLNL/sundials/commit/1350421eab6c5ab479de5eccf6af2dcad1eddf30.patch";
29+ sha256 = "0g67lixp9m85fqpb9rzz1hl1z8ibdg0ldwq5z6flj5zl8a7cw52l";
30+ })
31+ (fetchurl {
32+ # https://github.com/LLNL/sundials/pull/20
33+ url = "https://github.com/LLNL/sundials/pull/20/commits/2d951bbe1ff7842fcd0dafa28c61b0aa94015f66.patch";
34+ sha256 = "0lcr6m4lk14yqrxah4rdscpczny5l7m1zpfsjh8bgspadfsgk512";
35+ })
36+ # https://github.com/LLNL/sundials/pull/21
37+ ./tests-parallel.patch
38+ ];
1639
17− nativeBuildInputs = [ cmake ];
18− buildInputs = [ python ];
40+ cmakeFlags = [
41+ "-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples"
42+ ] ++ stdenv.lib.optionals (lapackSupport) [
43+ "-DSUNDIALS_INDEX_TYPE=int32_t"
44+ "-DLAPACK_ENABLE=ON"
45+ "-DLAPACK_LIBRARIES=${liblapackShared}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary};${liblapackShared}/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
46+ ];
47+
48+ doCheck = true;
49+ checkPhase = "make test";
1950
2051 meta = with stdenv.lib; {
2152 description = "Suite of nonlinear differential/algebraic equation solvers";
2253 homepage = https://computation.llnl.gov/projects/sundials;
2354 platforms = platforms.all;
24− maintainers = [ maintainers.idontgetoutmuch ];
55+ maintainers = with maintainers; [ flokli idontgetoutmuch ];
2556 license = licenses.bsd3;
2657 };
27−
2858}
pkgs/development/libraries/sundials/tests-parallel.patchnew file+45
@@ -0,0 +1,45 @@
1+diff --git a/config/SundialsAddTest.cmake b/config/SundialsAddTest.cmake
2+index e965fed..a7fb1d2 100644
3+--- a/config/SundialsAddTest.cmake
4++++ b/config/SundialsAddTest.cmake
5+@@ -70,7 +70,7 @@ MACRO(SUNDIALS_ADD_TEST NAME EXECUTABLE)
6+ "--verbose"
7+ "--testname=${NAME}"
8+ "--executablename=$<TARGET_FILE:${EXECUTABLE}>"
9+- "--outputdir=${CMAKE_BINARY_DIR}/Testing/output"
10++ "--outputdir=${TEST_OUTPUT_DIR}"
11+ )
12+
13+ # do not diff the output and answer files
14+diff --git a/config/SundialsTesting.cmake b/config/SundialsTesting.cmake
15+index 815576a..d91801a 100644
16+--- a/config/SundialsTesting.cmake
17++++ b/config/SundialsTesting.cmake
18+@@ -29,6 +29,13 @@ IF(SUNDIALS_DEVTESTS)
19+ ENDIF()
20+ ENDIF()
21+
22++ # Directory for test output
23++ SET(TEST_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Testing/output)
24++
25++ IF(NOT EXISTS ${TEST_OUTPUT_DIR})
26++ FILE(MAKE_DIRECTORY ${TEST_OUTPUT_DIR})
27++ ENDIF()
28++
29+ # look for the testRunner script in the test directory
30+ FIND_PROGRAM(TESTRUNNER testRunner PATHS test)
31+ HIDE_VARIABLE(TESTRUNNER)
32+diff --git a/test/testRunner b/test/testRunner
33+index f450ec2..f1c8deb 100755
34+--- a/test/testRunner
35++++ b/test/testRunner
36+@@ -106,7 +106,8 @@ def main():
37+
38+ # create output directory if necessary
39+ if not os.path.exists(outDir):
40+- os.makedirs(outDir)
41++ error("Output directory does not exist, it must be created.", outDir)
42++ sys.exit(1)
43+ elif not os.path.isdir(outDir):
44+ error("Output directory exists but is not a directory, it must be deleted.", outDir)
45+ sys.exit(1)
pkgs/development/python-modules/scikits-odes/default.nixnew file+55
@@ -0,0 +1,55 @@
1+{ stdenv
2+, lib
3+, buildPythonPackage
4+, fetchFromGitHub
5+, fetchurl
6+, cython
7+, enum34
8+, gfortran
9+, isPy3k
10+, numpy
11+, pytest
12+, python
13+, scipy
14+, sundials_3
15+}:
16+
17+buildPythonPackage rec {
18+ pname = "scikits.odes";
19+ version = "2.4.0-9-g93075ae";
20+
21+ # we fetch github instead of Pypi, as we want #104 and #105, which don't apply cleanly on 2.4.0
22+ src = fetchFromGitHub {
23+ owner = "bmcage";
24+ repo = "odes";
25+ rev = "93075ae25c409f572f13ca7207fada5706f73c73";
26+ sha256 = "161rab7hy6r1a9xw1zby9xhnnmxi0zwdpzxfpjkw9651xn2k5xyw";
27+ };
28+
29+ nativeBuildInputs = [
30+ gfortran
31+ cython
32+ ];
33+
34+ propagatedBuildInputs = [
35+ numpy
36+ sundials_3
37+ scipy
38+ ] ++ lib.optionals (!isPy3k) [ enum34 ];
39+
40+ doCheck = true;
41+ checkInputs = [ pytest ];
42+
43+ checkPhase = ''
44+ cd $out/${python.sitePackages}/scikits/odes/tests
45+ pytest
46+ '';
47+
48+ meta = with stdenv.lib; {
49+ description = "A scikit offering extra ode/dae solvers, as an extension to what is available in scipy";
50+ homepage = https://github.com/bmcage/odes;
51+ license = licenses.bsd3;
52+ maintainers = with maintainers; [ flokli idontgetoutmuch ];
53+ platforms = [ "aarch64-linux" "x86_64-linux" "x86_64-darwin" ];
54+ };
55+}
pkgs/top-level/all-packages.nix+2
@@ -13746,6 +13746,8 @@ in
1374613746
1374713747 sundials = callPackage ../development/libraries/sundials { };
1374813748
13749+ sundials_3 = callPackage ../development/libraries/sundials/3.x.nix { };
13750+
1374913751 sutils = callPackage ../tools/misc/sutils { };
1375013752
1375113753 svrcore = callPackage ../development/libraries/svrcore { };
pkgs/top-level/python-packages.nix+2
@@ -4846,6 +4846,8 @@ in {
48464846
48474847 scikit-build = callPackage ../development/python-modules/scikit-build { };
48484848
4849+ scikits-odes = callPackage ../development/python-modules/scikits-odes { };
4850+
48494851 scikit-optimize = callPackage ../development/python-modules/scikit-optimize { };
48504852
48514853 scikit-tda = callPackage ../development/python-modules/scikit-tda { };