guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#50080] [PATCH v3 2/4] gnu: sundials: Fix various issues.


From: Paul A. Patience
Subject: [bug#50080] [PATCH v3 2/4] gnu: sundials: Fix various issues.
Date: Mon, 02 May 2022 13:28:39 +0000

This commit fixes various issues. First, some of SUNDIALS's CMake
variables were renamed at some point between 5.2.0 and 5.7.0, in
particular KLU_ENABLE, which was changed to ENABLE_KLU. Since
sundials-julia is essentially SUNDIALS 5.2.0, its configure flags need
to be different from those of the sundials package. Second, commit
61bcd648ca215e3d8e75b3a3f49bfb94d66f7c79, which updated SUNDIALS to
6.1.1, accidentally completely disabled PETSc support for
sundials-openmpi (PETSc is supported only with MPI) by removing the
relevant configure flags. Third, SUNDIALS's default index size is
64 bits, but PETSc's is 32 bits, and they need to be the same; this
issue is discussed in the next three paragraphs.

The default index size in SUNDIALS 3.1.1 (which was the sundials
package's version previous to the aforementioned commit) was also
64 bits (though it was configured through the SUNDIALS_INDEX_TYPE CMake
variable, which could take the values INT64_T or INT32_T), but
SUNDIALS's configure script didn't warn of any incompatibility with
PETSc's 32-bit indices. I don't know if this was an accidental omission
from the configure script or if SUNDIALS's index size didn't have to
correspond to PETSc's at the time.

Keeping 64-bit indices in SUNDIALS would require adding a package for
PETSc with 64-bit indices (using the --with-64-bit-indices configure
flag), possibly named petsc64-openmpi (to follow the style of the SCOTCH
packages, i.e., scotch, scotch32, etc., though there the unadorned
package name represents the 64-bit version, unlike the unadorned petsc),
which would in turn require a package for METIS with 64-bit
indices (using IDXTYPEWIDTH=64). However, SUNDIALS is an optional
dependency of deal.II, both of which have PETSc as an optional
dependency, and deal.II's index size (which defaults to 32 bits) must
match PETSc's. In other words, the current deal.II package can build
with SUNDIALS only if SUNDIALS has 32-bit indices.

Furthermore, users needing 64-bit indices in SUNDIALS probably also need
them in PETSc and other libraries. If and when 64-bit indices are deemed
necessary, we can add all the package variations at once (for SUNDIALS,
PETSc, METIS, deal.II and any others).

* gnu/packages/maths.scm (sundials)[source]: Reuse version in URL.
[native-inputs]: Capitalize and punctuate comment.
[inputs]: Remove petsc, now unnecessary gfortran, and obsolete
comment. Move TODO item to sundials-openmpi.
[arguments]<#:configure-flags>: Add -DSUNDIALS_INDEX_SIZE=32 to match
PETSc's 32-bit indices. Remove obsolete -DEXAMPLES_ENABLE_F77,
-DEXAMPLES_ENABLE_F90 and -DFCMIX_ENABLE. Mention new but currently
unusable -DBUILD_FORTRAN_MODULE_INTERFACE and
-DEXAMPLES_ENABLE_F2003. Rename KLU_ENABLE to ENABLE_KLU.
(sundials-openmpi): Use package/inherit.
[inputs]: Move openmpi and petsc-openmpi from here...
[propagated-inputs]: ...to here. Clarify comment.
[arguments]<#:configure-flags>: Add -DENABLE_PETSC and -DPETSC_DIR, the
equivalents of which were accidentally removed in commit
61bcd648ca215e3d8e75b3a3f49bfb94d66f7c79.
<#:phases>: Replace a tab with spaces.
[synopsis]: Replace OpenMPI with MPI to conform to other package
synopses.
(sundials-julia)[inputs]: Add gfortran.
[arguments]<#:configure-flags>: Set only, and manually, -DCMAKE_C_FLAGS,
-DSUNDIALS_INDEX_SIZE, -DKLU_ENABLE, -DKLU_INCLUDE_DIR,
-DKLU_LIBRARY_DIR and -DLAPACK_ENABLE instead of inheriting from the
sundials package, because some of SUNDIALS's CMake variables have
changed name.
[synopsis]: Capitalize “LAPACK”.
---
 gnu/packages/maths.scm | 64 +++++++++++++++++++++++++-----------------
 1 file changed, 38 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 2922d95a70..5d4778da83 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -6129,28 +6129,30 @@ (define-public sundials
     (source
      (origin
        (method url-fetch)
-       (uri (string-append 
"https://github.com/LLNL/sundials/releases/download/v6.1.1/";
-                           "sundials-" version ".tar.gz"))
+       (uri (string-append 
"https://github.com/LLNL/sundials/releases/download/v";
+                           version "/sundials-" version ".tar.gz"))
        (sha256
         (base32
          "0327a1fy8rilwc4brsqqb71jd1ymb7mqgxsylab06crcg5xn7byg"))))
     (build-system cmake-build-system)
     (native-inputs
-     (list python-2))    ;for tests; syntax incompatible with python 3
+     (list python-2))          ; For tests; syntax incompatible with Python 3.
     (inputs
-     (list gfortran                               ;for fcmix
-           openblas petsc suitesparse))           ;TODO: Add hypre
+     (list openblas suitesparse))
     (arguments
-     `(#:configure-flags `("-DCMAKE_C_FLAGS=-O2 -g -fcommon"
+     '(#:configure-flags `("-DCMAKE_C_FLAGS=-O2 -g -fcommon"
+
+                           "-DSUNDIALS_INDEX_SIZE=32"
+                           ;; Incompatible with 32-bit indices.
+                           ;;"-DBUILD_FORTRAN_MODULE_INTERFACE:BOOL=ON"
+
                            "-DEXAMPLES_ENABLE_C:BOOL=ON"
                            "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
-                           "-DEXAMPLES_ENABLE_F77:BOOL=ON"
-                           "-DEXAMPLES_ENABLE_F90:BOOL=ON"
+                           ;; Requires 
-DBUILD_FORTRAN_MODULE_INTERFACE:BOOL=ON.
+                           ;;"-DEXAMPLES_ENABLE_F2003:BOOL=ON"
                            "-DEXAMPLES_INSTALL:BOOL=OFF"

-                           "-DFCMIX_ENABLE:BOOL=ON"
-
-                           "-DKLU_ENABLE:BOOL=ON"
+                           "-DENABLE_KLU:BOOL=ON"
                            ,(string-append "-DKLU_INCLUDE_DIR="
                                            (assoc-ref %build-inputs 
"suitesparse")
                                            "/include")
@@ -6168,22 +6170,26 @@ (define-public sundials
     (license license:bsd-3)))

 (define-public sundials-openmpi
-  (package
-    (inherit sundials)
+  (package/inherit sundials
     (name "sundials-openmpi")
-    (inputs
-     (modify-inputs (package-inputs sundials)
-       (delete "petsc")
-       (prepend openmpi petsc-openmpi)))     ;support in SUNDIALS requires MPI
+    (propagated-inputs
+     (list openmpi
+           ;; Support for the below requires MPI.
+           ;; TODO: Add HYPRE.
+           petsc-openmpi))
     (arguments
      (substitute-keyword-arguments (package-arguments sundials)
        ((#:configure-flags flags '())
-        `(cons* "-DENABLE_MPI:BOOL=ON" ,flags))
+        `(cons* "-DENABLE_MPI:BOOL=ON"
+                "-DENABLE_PETSC:BOOL=ON"
+                (string-append "-DPETSC_DIR="
+                               (assoc-ref %build-inputs "petsc-openmpi"))
+                ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
            (add-before 'check 'mpi-setup
-            ,%openmpi-setup)))))
-    (synopsis "SUNDIALS with OpenMPI support")))
+             ,%openmpi-setup)))))
+    (synopsis "SUNDIALS with MPI support")))

 (define-public sundials-julia
   (package
@@ -6202,13 +6208,19 @@ (define-public sundials-julia
          "0nx4sqhmi126m14myzm7syv2053harav9snl0a247wnkcgs5rxrv"))))
     (inputs
      (modify-inputs (package-inputs sundials)
-       (prepend lapack)))
+       (prepend gfortran lapack)))
     (arguments
-     (substitute-keyword-arguments (package-arguments sundials)
-       ((#:configure-flags flags '())
-        `(cons* "-DLAPACK_ENABLE:BOOL=ON"
-                ,flags))))
-    (synopsis "SUNDIALS with lapack support as required by 
julia-sundials-jll")))
+     '(#:configure-flags `("-DCMAKE_C_FLAGS=-O2 -g -fcommon"
+                           "-DSUNDIALS_INDEX_SIZE=32"
+                           "-DKLU_ENABLE:BOOL=ON"
+                           ,(string-append "-DKLU_INCLUDE_DIR="
+                                           (assoc-ref %build-inputs 
"suitesparse")
+                                           "/include")
+                           ,(string-append "-DKLU_LIBRARY_DIR="
+                                           (assoc-ref %build-inputs 
"suitesparse")
+                                           "/lib")
+                           "-DLAPACK_ENABLE:BOOL=ON")))
+    (synopsis "SUNDIALS with LAPACK support as required by 
julia-sundials-jll")))

 (define-public combinatorial-blas
   (package
--
2.36.0







reply via email to

[Prev in Thread] Current Thread [Next in Thread]