Paste number 330792: trilinos package

Paste number 330792: trilinos package
Pasted by: bavier
When:5 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+738O
Channel:None
Paste contents:
Raw Source | XML | Display As
(define-public trilinos
  (package
    (name "trilinos")
    (version "12.8.1")
    (source
     (origin
       (method url-fetch)
       (uri (list (string-append "https://trilinos.org/oldsite/download/files/"
                                 "trilinos-" version "-Source.tar.bz2")
                  (string-append "http://trilinos.csbsju.edu/download/files/"
                                 "trilinos-" version "-Source.tar.bz2")))
       (file-name (string-append name "-" version ".tar.bz2"))
       (sha256
        (base32
         "18mk7nxlw0bd49w6xxrvyw1jd661ivx4ci2adf3hd43i5z2yqpsi"))
       (patches (map search-patch '("trilinos-superlu5.patch"
                                    "trilinos-test-fixes.patch")))))
    (build-system cmake-build-system)
    (native-inputs
     `(("gfortran" ,gfortran)))
    (inputs
     `(("blas" ,openblas)
       ("lapack" ,lapack)
       ;; "TPL" libraries.
       ("suitesparse" ,suitesparse)     ;UMFPACK, AMD, Cholmod
       ("libiberty" ,libiberty)
       ("superlu" ,superlu)
       ("libx11" ,libx11)
       ("netcdf" ,netcdf)
       ("scotch" ,scotch)
       ("metis" ,metis)
       ("matio" ,matio)
       ("hwloc" ,hwloc)
       ("boost" ,boost)
       ("hdf5" ,hdf5)
       ("zlib" ,zlib)))
    (arguments
     `(#:parallel-tests? #t
       #:configure-flags
       `("-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=YES"
         "-DTrilinos_ENABLE_SECONDARY_TESTED_CODE:BOOL=YES"
         "-DTrilinos_LIBRARY_NAME_PREFIX:STRING=trilinos_"
         "-DTrilinos_INSTALL_INCLUDE_DIR:STRING=include/trilinos/"
         "-DTrilinos_ENABLE_DEVELOPMENT_MODE:BOOL=NO"
         "-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=YES"
         "-DTrilinos_ENABLE_OpenMP:BOOL=YES"
         "-DTrilinos_ENABLE_Fortran:BOOL=YES"
         "-DTrilinos_ENABLE_TESTS:BOOL=NO" ;also builds examples
         ;; Build shared rather than static libraries
         "-DBUILD_SHARED_LIBS:BOOL=YES"

         ;; Enable optional package features
         "-DAmesos2_ENABLE_KLU2:BOOL=YES"
         "-DAmesos2_ENABLE_Basker:BOOL=YES"
         "-DEpetra_ENABLE_THREADS:BOOL=YES"
         "-DKokkos_ENABLE_OpenMP:BOOL=YES"
         "-DZoltan_ENABLE_METIS:BOOL=NO" ;no support for metis >= 5
         "-DZoltan2_ENABLE_AMD:BOOL=NO" ;https://github.com/trilinos/Trilinos/issues/183

         ;; Disable packages
         "-DTrilinos_ENABLE_PyTrilinos:BOOL=NO"  ;requires python
         "-DTrilinos_ENABLE_STK:BOOL=NO"         ;requires MPI
         "-DTrilinos_ENABLE_Pike:BOOL=NO"        ;requires MPI
         "-DTrilinos_ENABLE_CTrilinos:BOOL=NO"   ;unmaintained
         "-DTrilinos_ENABLE_ForTrilinos:BOOL=NO" ;unmaintained

         ;; Enable third-party libraries that are not enabled by default
         "-DTPL_ENABLE_SuperLU:BOOL=YES"
         "-DTPL_ENABLE_UMFPACK:BOOL=YES"
         "-DTPL_ENABLE_Cholmod:BOOL=YES"
         "-DTPL_ENABLE_CCOLAMD:BOOL=YES"
         "-DTPL_ENABLE_AMD:BOOL=YES"
         "-DTPL_ENABLE_Scotch:BOOL=YES"
         "-DTPL_ENABLE_METIS:BOOL=YES"
         "-DTPL_ENABLE_HWLOC:BOOL=YES"
         "-DTPL_ENABLE_Boost:BOOL=YES"
         "-DTPL_ENABLE_HDF5:BOOL=YES"
         "-DTPL_ENABLE_BinUtils:BOOL=YES"
         "-DTPL_ENABLE_Zlib:BOOL=YES"
         "-DTPL_ENABLE_X11:BOOL=YES"
         ;; TPL-specific configurations
         "-DTPL_BLAS_LIBRARIES=openblas"
         "-DTPL_UMFPACK_LIBRARIES=umfpack;cholmod;amd;suitesparseconfig")
       #:modules ((ice-9 rdelim)
                  (ice-9 regex)
                  (srfi srfi-1)
                  (srfi srfi-26)
                  (guix build cmake-build-system)
                  (guix build utils))
       #:phases
       (modify-phases %standard-phases
         (delete 'check)
         (add-after 'install 'clean
           (lambda _
             (zero? (system* "make" "clean"))))
         (add-after 'clean 'install-check
           ;; Tests take a long time to build, and large amounts of disk space
           ;; (~10GiB build + ~4.5GiB tests) that can not be incrementaly
           ;; cleaned up since the "install" target depends on test binaries.
           ;; Use Trilinos's "installation testing" mechanism.  This allows
           ;; the initial build to be cleaned prior to testing, and allows
           ;; each package's tests to be cleaned after being run.
           (lambda* (#:key outputs configure-flags parallel-tests?
                     #:allow-other-keys)
             (define (read-packages)
               (call-with-input-file
                   (string-append (assoc-ref outputs "out")
                                  "/lib/cmake/Trilinos/TrilinosConfig.cmake")
                 (let ((package-list-regexp
                        (make-regexp "^SET\\(Trilinos_PACKAGE_LIST \"(.*)\"\\)$")))
                   (lambda (port)
                     (let loop ()
                       (let* ((line (read-line port)))
                         (cond
                          ((eof-object? line) ;This should not happen!
                           (error "Failed to read enabled Trilinos packages"))
                          ((regexp-exec package-list-regexp line)
                           => (lambda (m)
                                (let ((packages (string-split (match:substring m 1)
                                                              #\;)))
                                  ;; Do not include "subpackages", since they
                                  ;; are tested together with their parent
                                  ;; package.
                                  (delete-duplicates packages string-prefix?))))
                          (else
                           (loop)))))))))

             (define (test-package package disable)
               (let ((dir (string-append "_test-" package))
                     (-j (format #f "-j~a" (parallel-job-count)))
                     (base-config-flags
                      (remove (cut string-match
                                "(ENABLE_ALL_PACKAGES|ENABLE_TESTS)" <>)
                              configure-flags)))
                 (mkdir-p dir)
                 (and (with-directory-excursion dir
                        (and (zero?
                              (apply system* "cmake"
                                     (string-append
                                      "-D" package "_ENABLE_TESTS:BOOL=YES")
                                     (string-append
                                      "-DTrilinos_INSTALLATION_DIR="
                                      (assoc-ref outputs "out"))
                                     (string-append
                                      "-DTrilinos_ENABLE_" package "=YES")
                                     (string-append "../../trilinos-"
                                                    ,version "-Source")
                                     (append base-config-flags
                                             (map (cut string-append
                                                    "-D" <> "_DISABLE=YES")
                                                  disable))))
                             ;; Some dependencies are improperly specified, so
                             ;; make may fail and tests still pass; use '-k'.
                             (zero? (system* "make" -j "-k"))
                             (zero? (system* "make" "test"
                                             (string-append "ARGS="
                                                            (if parallel-tests?
                                                                -j ""))))))
                      (begin (delete-file-recursively dir) #t))))

             (let ((skip '("Gtest"      ;no tests
                           "Moertel"    ;failed SEACAS tests
                           "STK"        ;ditto
                           "SEACAS"     ;missing exodusII_test.h
                           ;; https://github.com/trilinos/Trilinos/issue/270.
                           ;; Using *_DISABLE doesn't seem to work, so skip
                           ;; the whole suite.
                           "Tpetra"
                           ;; http://github.com/trilinos/Trilinos/issues/327
                           "Kokkos"
                           ;; Headers missing issue when MPI
                           "Pike"
                           "MOOCHO"     ;tests take a *really* long time
                           "Zoltan2"))  ;missing zoltan_id.h, Epetra_MpiComm.h
                   (disable '("NOX_Thyra_Heq_MPI_1"
                              "NOX_Thyra_Heq"
                              ;; See https://github.com/trilinos/Trilinos/issue/211
                              "TeuchosNumerics_BLAS_ROTG_test_MPI_1"
                              "TeuchosNumerics_BLAS_ROTG_test"
                              ;; Error tolerance failure
                              "Teko_DiagonallyScaledPreconditioner_MPI_1"
                              "Teko_DiagonallyScaledPreconditioner")))
               (every (cut test-package <> disable)
                      (remove (cut member <> skip)
                              (read-packages)))))))))
    (home-page "https://www.trilinos.org")
    (synopsis "Solvers for engineering and scientific problems")
    (description
     "The Trilinos project is an effort to develop rebust algorithms and
enabling technologies within an object-oriented software framework for the
solution of large-scale, complex multi-physics engineering and scientific
problems.")
    ;; Some packages are under LGPL, others under BSD 3-clause.  Some other
    ;; source is under other licenses.  See
    ;; https://trilinos.org/download/license/
    (license (list license:lgpl2.1+
                   license:bsd-3
                   license:public-domain ;murmurhash in Zoltan
                   license:asl2.0  ;Stokhos, bootstrap-transition.js in Common
                   license:expat))))

(define-public trilinos-openmpi
  (package (inherit trilinos)
    (name "trilinos-openmpi")
    (inputs
     `(("mpi" ,openmpi)
       ("mumps" ,mumps-openmpi)         ;MUMPS is only supported with MPI.
       ("pt-scotch" ,pt-scotch)
       ("scalapack" ,scalapack)
       ("hdf5" ,hdf5-parallel-openmpi)
       ("netcdf" ,netcdf-parallel-openmpi)
       ,@(fold alist-delete
               (package-inputs trilinos)
               '("hdf5" "netcdf" "scotch"))))
    (arguments
     (substitute-keyword-arguments (package-arguments trilinos)
       ((#:configure-flags flags)
        `(append ,flags
                 `("-DCMAKE_C_COMPILER=mpicc"
                   "-DCMAKE_CXX_COMPILER=mpicxx"
                   "-DCMAKE_Fortran_COMPILER=mpifort"
                   "-DTrilinos_ENABLE_STK:BOOL=YES"
                   "-DTrilinos_ENABLE_STKClassic:BOOL=NO"
                   "-DTrilinos_ENABLE_Pike:BOOL=YES"
                   "-DTPL_ENABLE_MPI:BOOL=YES"
                   "-DTPL_ENABLE_MUMPS:BOOL=YES"
                   ,(string-append "-DTPL_MUMPS_LIBRARIES="
                                   "dmumps;mumps_common;scalapack;lapack;"
                                   "ptscotch;scotch;scotcherr;"
                                   "metis;ptesmumps;esmumps;pord")
                   "-DTPL_Netcdf_LIBRARIES=netcdf;hdf5_hl;hdf5;dl;m;z"
                   "-DTPL_ENABLE_SCALAPACK:BOOL=YES"
                   "-DZoltan_ENABLE_F90INTERFACE:BOOL=YES" ;only works with MPI
                   "-DMPI_EXEC:FILEPATH=mpirun")))
       ((#:parallel-tests? _) #f)))
    (synopsis "Parallel solvers for engineering and scientific problems")))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.