diff options
| -rw-r--r-- | gnu-system.am | 1 | ||||
| -rw-r--r-- | gnu/packages/maths.scm | 89 | ||||
| -rw-r--r-- | gnu/packages/patches/petsc-fix-threadcomm.patch | 15 |
3 files changed, 105 insertions, 0 deletions
diff --git a/gnu-system.am b/gnu-system.am index c18db0dc567..0bf3eece309 100644 --- a/gnu-system.am +++ b/gnu-system.am | |||
| @@ -323,6 +323,7 @@ dist_patch_DATA = \ | |||
| 323 | gnu/packages/patches/patchelf-page-size.patch \ | 323 | gnu/packages/patches/patchelf-page-size.patch \ |
| 324 | gnu/packages/patches/patchutils-xfail-gendiff-tests.patch \ | 324 | gnu/packages/patches/patchutils-xfail-gendiff-tests.patch \ |
| 325 | gnu/packages/patches/perl-no-sys-dirs.patch \ | 325 | gnu/packages/patches/perl-no-sys-dirs.patch \ |
| 326 | gnu/packages/patches/petsc-fix-threadcomm.patch \ | ||
| 326 | gnu/packages/patches/plotutils-libpng-jmpbuf.patch \ | 327 | gnu/packages/patches/plotutils-libpng-jmpbuf.patch \ |
| 327 | gnu/packages/patches/procps-make-3.82.patch \ | 328 | gnu/packages/patches/procps-make-3.82.patch \ |
| 328 | gnu/packages/patches/python-fix-tests.patch \ | 329 | gnu/packages/patches/python-fix-tests.patch \ |
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 03f6be120b7..8ac9e461a15 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm | |||
| @@ -366,3 +366,92 @@ mesh, solver and post-processing. The specification of any input to these | |||
| 366 | modules is done either interactively using the graphical user interface or in | 366 | modules is done either interactively using the graphical user interface or in |
| 367 | ASCII text files using Gmsh's own scripting language.") | 367 | ASCII text files using Gmsh's own scripting language.") |
| 368 | (license license:gpl2+))) | 368 | (license license:gpl2+))) |
| 369 | |||
| 370 | (define-public petsc | ||
| 371 | (package | ||
| 372 | (name "petsc") | ||
| 373 | (version "3.4.4") | ||
| 374 | (source | ||
| 375 | (origin | ||
| 376 | (method url-fetch) | ||
| 377 | ;; The *-lite-* tarball does not contain the *large* documentation | ||
| 378 | (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/" | ||
| 379 | "petsc-lite-" version ".tar.gz")) | ||
| 380 | (sha256 | ||
| 381 | (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv")) | ||
| 382 | (patches | ||
| 383 | (list (search-patch "petsc-fix-threadcomm.patch"))))) | ||
| 384 | (build-system gnu-build-system) | ||
| 385 | (native-inputs | ||
| 386 | `(("python" ,python-2) | ||
| 387 | ("perl" ,perl))) | ||
| 388 | (inputs | ||
| 389 | `(("gfortran" ,gfortran-4.8) | ||
| 390 | ("lapack" ,lapack) | ||
| 391 | ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi | ||
| 392 | ;; leaving out opengl, as configuration seems to only be for mac | ||
| 393 | )) | ||
| 394 | (arguments | ||
| 395 | `(#:test-target "test" | ||
| 396 | #:parallel-build? #f | ||
| 397 | #:configure-flags | ||
| 398 | `("--with-mpi=0" | ||
| 399 | "--with-openmp=1") | ||
| 400 | #:phases | ||
| 401 | (alist-replace | ||
| 402 | 'configure | ||
| 403 | ;; PETSc's configure script is actually a python script, so we can't | ||
| 404 | ;; run it with bash. | ||
| 405 | (lambda* (#:key outputs (configure-flags '()) | ||
| 406 | #:allow-other-keys) | ||
| 407 | (let* ((prefix (assoc-ref outputs "out")) | ||
| 408 | (flags `(,(string-append "--prefix=" prefix) | ||
| 409 | ,@configure-flags))) | ||
| 410 | (format #t "build directory: ~s~%" (getcwd)) | ||
| 411 | (format #t "configure flags: ~s~%" flags) | ||
| 412 | (zero? (apply system* "./configure" flags)))) | ||
| 413 | (alist-cons-after | ||
| 414 | 'install 'clean-local-references | ||
| 415 | ;; Try to keep installed files from leaking build directory names. | ||
| 416 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 417 | (let ((out (assoc-ref outputs "out")) | ||
| 418 | (fortran (assoc-ref inputs "gfortran"))) | ||
| 419 | (substitute* (map (lambda (file) | ||
| 420 | (string-append out "/" file)) | ||
| 421 | '("conf/petscvariables" | ||
| 422 | "conf/PETScConfig.cmake" | ||
| 423 | "include/petscconf.h" | ||
| 424 | "include/petscmachineinfo.h")) | ||
| 425 | (((getcwd)) out)) | ||
| 426 | ;; Make compiler references point to the store | ||
| 427 | (substitute* (string-append out "/conf/petscvariables") | ||
| 428 | (("= g(cc|\\+\\+|fortran)" _ suffix) | ||
| 429 | (string-append "= " fortran "/bin/g" suffix))) | ||
| 430 | ;; PETSc installs some build logs, which aren't necessary. | ||
| 431 | (for-each (lambda (file) | ||
| 432 | (delete-file (string-append out "/" file))) | ||
| 433 | '("conf/configure.log" | ||
| 434 | "conf/make.log" | ||
| 435 | "conf/test.log" | ||
| 436 | "conf/RDict.db" | ||
| 437 | ;; Once installed, should uninstall with Guix | ||
| 438 | "conf/uninstall.py")))) | ||
| 439 | %standard-phases)))) | ||
| 440 | (home-page "http://www.mcs.anl.gov/petsc") | ||
| 441 | (synopsis "Library to solve ODEs and algebraic equations") | ||
| 442 | (description "PETSc, pronounced PET-see (the S is silent), is a suite of | ||
| 443 | data structures and routines for the scalable (parallel) solution of | ||
| 444 | scientific applications modeled by partial differential equations.") | ||
| 445 | (license (license:bsd-style | ||
| 446 | "http://www.mcs.anl.gov/petsc/documentation/copyright.html")))) | ||
| 447 | |||
| 448 | (define-public petsc-complex | ||
| 449 | (package (inherit petsc) | ||
| 450 | (name "petsc-complex") | ||
| 451 | (arguments | ||
| 452 | (substitute-keyword-arguments (package-arguments petsc) | ||
| 453 | ((#:configure-flags cf) | ||
| 454 | `(cons "--with-scalar-type=complex" ,cf)))) | ||
| 455 | (description | ||
| 456 | (string-append (package-description petsc) | ||
| 457 | " Complex scalar type version.")))) | ||
diff --git a/gnu/packages/patches/petsc-fix-threadcomm.patch b/gnu/packages/patches/petsc-fix-threadcomm.patch new file mode 100644 index 00000000000..3ef4f2d83d0 --- /dev/null +++ b/gnu/packages/patches/petsc-fix-threadcomm.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Fix "error: unknown type name 'cpu_set_t'". Patch submitted upstream | ||
| 2 | http://lists.mcs.anl.gov/pipermail/petsc-dev/2014-May/015345.html | ||
| 3 | |||
| 4 | --- a/src/sys/threadcomm/impls/openmp/tcopenmp.c 2014-03-13 21:47:22.000000000 -0500 | ||
| 5 | +++ b/src/sys/threadcomm/impls/openmp/tcopenmp.c 2014-04-02 14:44:57.185170151 -0500 | ||
| 6 | @@ -1,6 +1,9 @@ | ||
| 7 | #define PETSC_DESIRE_FEATURE_TEST_MACROS | ||
| 8 | #include <../src/sys/threadcomm/impls/openmp/tcopenmpimpl.h> | ||
| 9 | #include <omp.h> | ||
| 10 | +#if defined(PETSC_HAVE_SCHED_CPU_SET_T) | ||
| 11 | +#include <sched.h> | ||
| 12 | +#endif | ||
| 13 | |||
| 14 | PetscErrorCode PetscThreadCommGetRank_OpenMP(PetscInt *trank) | ||
| 15 | { | ||
