summaryrefslogtreecommitdiff
path: root/gnu/packages/simulation.scm
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2025-07-04 11:10:21 +0100
committerAndreas Enge <andreas@enge.fr>2025-07-05 16:47:08 +0200
commita8769dddaae1aa00a5eebfb2639ca5b138fcad22 (patch)
tree71ad3ccdec7e321bd0c0afa9ee4e120cd1219d8c /gnu/packages/simulation.scm
parentd636feabcf52c93a5d66fa344e4b30f46be561e1 (diff)
gnu: fenics: Fix build.
* gnu/packages/simulation.scm (fenics): Run guix style, improve formatting. [arguments] <phases>: Remove test module references to expired numpy aliases in the 'pre-check' phase. Use '--deselect' instead of '--ignore' to skip a test in the 'check' phase. Add a FIXME note to enable reading and writing files in the binary HDF5 format. Signed-off-by: Andreas Enge <andreas@enge.fr>
Diffstat (limited to 'gnu/packages/simulation.scm')
-rw-r--r--gnu/packages/simulation.scm196
1 files changed, 99 insertions, 97 deletions
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index e6f86fb7366..7d7668f117d 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -917,108 +917,110 @@ user interface to the FEniCS core components and external libraries.")
917 (list fenics-dolfin 917 (list fenics-dolfin
918 python-petsc4py 918 python-petsc4py
919 python-slepc4py 919 python-slepc4py
920 920 ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at runtime.
921 ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at run time.
922 python-pkgconfig)) 921 python-pkgconfig))
923 (arguments 922 (arguments
924 (list #:phases 923 (list
925 #~(modify-phases %standard-phases 924 #:phases
926 (add-after 'unpack 'relax-requirements 925 #~(modify-phases %standard-phases
927 (lambda _ 926 (add-after 'unpack 'relax-requirements
928 (substitute* "python/setup.py" 927 (lambda _
929 (("pybind11==") 928 (substitute* "python/setup.py"
930 "pybind11>=")))) 929 (("pybind11==") "pybind11>="))))
931 (add-after 'unpack 'set-dolfin-pc-file-name 930 (add-after 'unpack 'set-dolfin-pc-file-name
932 (lambda* (#:key inputs #:allow-other-keys) 931 (lambda* (#:key inputs #:allow-other-keys)
933 ;; Instead of cluttering the user's 'PKG_CONFIG_PATH' environment 932 ;; Instead of cluttering the user's PKG_CONFIG_PATH environment
934 ;; variable, hard-code the 'dolfin.pc' absolute file name. 933 ;; variable, hard-code the 'dolfin.pc' absolute file name.
935 (let ((pc-file (search-input-file inputs 934 (let ((pc-file (search-input-file inputs
936 "/lib/pkgconfig/dolfin.pc"))) 935 "/lib/pkgconfig/dolfin.pc")))
937 (substitute* "python/dolfin/jit/jit.py" 936 (substitute* "python/dolfin/jit/jit.py"
938 (("pkgconfig\\.parse\\(\"dolfin\"\\)") 937 (("pkgconfig\\.parse\\(\"dolfin\"\\)")
939 (string-append "pkgconfig.parse(\"" pc-file 938 (string-append "pkgconfig.parse(\"" pc-file "\")"))))))
940 "\")")))))) 939 (add-after 'patch-source-shebangs 'set-paths
941 (add-after 'patch-source-shebangs 'set-paths 940 (lambda _
942 (lambda _ 941 ;; Define paths to store locations.
943 ;; Define paths to store locations. 942 (setenv "PYBIND11_DIR" #$(this-package-input "pybind11"))
944 (setenv "PYBIND11_DIR" #$(this-package-input "pybind11")) 943 ;; Move to python sub-directory.
945 ;; Move to python sub-directory. 944 (chdir "python")))
946 (chdir "python"))) 945 (add-after 'build 'mpi-setup
947 (add-after 'build 'mpi-setup 946 #$%openmpi-setup)
948 #$%openmpi-setup) 947 (add-before 'check 'pre-check
949 (add-before 'check 'pre-check 948 (lambda _
950 (lambda _ 949 ;; Exclude three tests that generate 'NotImplementedError' in
951 ;; Exclude three tests that generate 950 ;; matplotlib v3.1.2. See
952 ;; 'NotImplementedError' in matplotlib version 3.1.2. 951 ;; <https://github.com/matplotlib/matplotlib/issues/15382>.
953 ;; See 952 ;; Also exclude tests that require meshes supplied by git-lfs.
954 ;; <https://github.com/matplotlib/matplotlib/issues/15382>. 953 (substitute* "demo/test.py"
955 ;; Also exclude tests that require meshes supplied by 954 (("(.*stem !.*)" line)
956 ;; git-lfs. 955 (string-append line
957 (substitute* "demo/test.py" 956 "\n"
958 (("(.*stem !.*)" line) 957 "excludeList = [\n"
959 (string-append line 958 "'built-in-meshes', \n"
960 "\n" 959 "'hyperelasticity', \n"
961 "excludeList = [\n" 960 "'elasticity', \n"
962 "'built-in-meshes', \n" 961 "'multimesh-quadrature', \n"
963 "'hyperelasticity', \n" 962 "'multimesh-marking', \n"
964 "'elasticity', \n" 963 "'mixed-poisson-sphere', \n"
965 "'multimesh-quadrature', \n" 964 "'mesh-quality', \n"
966 "'multimesh-marking', \n" 965 "'lift-drag', \n"
967 "'mixed-poisson-sphere', \n" 966 "'elastodynamics', \n"
968 "'mesh-quality', \n" 967 "'dg-advection-diffusion', \n"
969 "'lift-drag', \n" 968 "'curl-curl', \n"
970 "'elastodynamics', \n" 969 "'contact-vi-tao', \n"
971 "'dg-advection-diffusion', \n" 970 "'contact-vi-snes', \n"
972 "'curl-curl', \n" 971 "'collision-detection', \n"
973 "'contact-vi-tao', \n" 972 "'buckling-tao', \n"
974 "'contact-vi-snes', \n" 973 "'auto-adaptive-navier-stokes', \n"
975 "'collision-detection', \n" 974 "'advection-diffusion', \n"
976 "'buckling-tao', \n" 975 "'subdomains', \n"
977 "'auto-adaptive-navier-stokes', \n" 976 "'stokes-taylor-hood', \n"
978 "'advection-diffusion', \n" 977 "'stokes-mini', \n"
979 "'subdomains', \n" 978 "'navier-stokes', \n"
980 "'stokes-taylor-hood', \n" 979 "'eigenvalue']\n"
981 "'stokes-mini', \n" 980 "demos = ["
982 "'navier-stokes', \n" 981 "d for d in demos if d[0].stem not "
983 "'eigenvalue']\n" 982 "in excludeList]\n")))
984 "demos = [" 983 ;; Do not test for expired numpy aliases.
985 "d for d in demos if d[0].stem not in " 984 (substitute* "test/unit/la/test_vector.py"
986 "excludeList]\n"))) 985 ((" numpy.float\\(42.0\\),") "")
987 (setenv "HOME" 986 (("^.*numpy.int\\(42.0\\).*$") ""))
988 (getcwd)) 987 (substitute* "test/unit/la/test_la_basic.py"
989 ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP. 988 ((" int,") " ")
990 (setenv "OPENBLAS_NUM_THREADS" "1"))) 989 (("\\[int,") "["))
991 (replace 'check 990 (setenv "HOME" (getcwd))
992 (lambda* (#:key tests? #:allow-other-keys) 991 ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
993 (when tests? 992 (setenv "OPENBLAS_NUM_THREADS" "1")))
994 (with-directory-excursion "test" 993 (replace 'check
995 (invoke "pytest" 994 (lambda* (#:key tests? #:allow-other-keys)
996 "unit" 995 (when tests?
997 ;; The test test_snes_set_from_options() in the file 996 (with-directory-excursion "test"
998 ;; unit/nls/test_PETScSNES_solver.py fails and is ignored. 997 (invoke "pytest"
999 "--ignore" 998 "unit"
1000 "unit/nls/test_PETScSNES_solver.py" 999 ;; This test fails and is ignored.
1001 ;; Fails with a segfault. 1000 "--deselect"
1002 "--ignore" 1001 "unit/nls/test_PETScSNES_solver.py::test_snes_set_from_options"
1003 "unit/io/test_XDMF.py"))))) 1002 ;; FIXME: Tests with binary encoded hdf5 files fail with a
1004 (add-after 'install 'install-demo-files 1003 ;; segfault. See fenics-project DOLFIN commit 6fbc9fb.
1005 (lambda* (#:key outputs #:allow-other-keys) 1004 "--ignore"
1006 (let* ((demos (string-append (assoc-ref outputs "out") 1005 "unit/io/test_XDMF.py")))))
1007 "/share/python-dolfin/demo"))) 1006 (add-after 'install 'install-demo-files
1008 (mkdir-p demos) 1007 (lambda* (#:key outputs #:allow-other-keys)
1009 (with-directory-excursion "demo" 1008 (let* ((demos (string-append (assoc-ref outputs "out")
1010 (for-each (lambda (file) 1009 "/share/python-dolfin/demo")))
1011 (let* ((dir (dirname file)) 1010 (mkdir-p demos)
1012 (tgt-dir (string-append 1011 (with-directory-excursion "demo"
1013 demos "/" dir))) 1012 (for-each (lambda (file)
1014 (unless (equal? "." dir) 1013 (let* ((dir (dirname file))
1015 (mkdir-p tgt-dir) 1014 (tgt-dir (string-append demos
1016 (install-file file tgt-dir)))) 1015 "/" dir)))
1017 (find-files "." ".*\\.(py|gz|xdmf)$"))))))))) 1016 (unless (equal? "." dir)
1017 (mkdir-p tgt-dir)
1018 (install-file file tgt-dir))))
1019 (find-files "." ".*\\.(py|gz|xdmf)$")))))))))
1018 (home-page "https://fenicsproject.org/") 1020 (home-page "https://fenicsproject.org/")
1019 (synopsis "High-level environment for solving differential equations") 1021 (synopsis "High-level environment for solving differential equations")
1020 (description 1022 (description
1021 "@code{fenics} is a computing platform for solving general classes of 1023 "@code{fenics} is a computing platform for solving general classes of
1022problems that involve differential equations. @code{fenics} facilitates 1024problems that involve differential equations. @code{fenics} facilitates
1023access to efficient methods for dealing with ordinary differential 1025access to efficient methods for dealing with ordinary differential
1024equations (ODEs) and partial differential equations (PDEs). Systems of 1026equations (ODEs) and partial differential equations (PDEs). Systems of