From a0c2a25a72136f705e411a86b7f4bdfec5126505 Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Wed, 13 Jun 2018 13:42:21 -0700 Subject: [mfem] new version: 3.4 (#8453) * Add new version (3.4.0) with new variant (pumi). * Fix an issue: skip the tests in examples/pumi as they require files that are not included in the mfem distribution/repository. * Use patches to fix the testing issues with PUMI and PETSc v3.9. * Use the new bit.ly short link for v3.4. --- .../packages/mfem/mfem-3.3-3.4-petsc-3.9.patch | 71 ++++++++++++++++++++++ .../repos/builtin/packages/mfem/mfem-3.4.patch | 36 +++++++++++ var/spack/repos/builtin/packages/mfem/package.py | 39 +++++++++--- .../repos/builtin/packages/mfem/test_builds.sh | 5 +- 4 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 var/spack/repos/builtin/packages/mfem/mfem-3.3-3.4-petsc-3.9.patch create mode 100644 var/spack/repos/builtin/packages/mfem/mfem-3.4.patch diff --git a/var/spack/repos/builtin/packages/mfem/mfem-3.3-3.4-petsc-3.9.patch b/var/spack/repos/builtin/packages/mfem/mfem-3.3-3.4-petsc-3.9.patch new file mode 100644 index 0000000000..dcf4870a25 --- /dev/null +++ b/var/spack/repos/builtin/packages/mfem/mfem-3.3-3.4-petsc-3.9.patch @@ -0,0 +1,71 @@ +diff --git a/examples/petsc/rc_ex3p b/examples/petsc/rc_ex3p +index 2cbe07ef2..c585d9b52 100644 +--- a/examples/petsc/rc_ex3p ++++ b/examples/petsc/rc_ex3p +@@ -6,4 +6,4 @@ + # it needs PETSc configured with MUMPS + + -solver_pc_type cholesky +--solver_pc_factor_mat_solver_package mumps ++-solver_pc_factor_mat_solver_type mumps +diff --git a/examples/petsc/rc_ex3p_bddc b/examples/petsc/rc_ex3p_bddc +index ea887bb29..2e1eba0d5 100644 +--- a/examples/petsc/rc_ex3p_bddc ++++ b/examples/petsc/rc_ex3p_bddc +@@ -16,7 +16,7 @@ + #-pc_bddc_adaptive_threshold 10 + + # Customization of the local solvers +-#-pc_bddc_neumann_pc_factor_mat_solver_package mumps +-#-pc_bddc_dirichlet_pc_factor_mat_solver_package mumps ++#-pc_bddc_neumann_pc_factor_mat_solver_type mumps ++#-pc_bddc_dirichlet_pc_factor_mat_solver_type mumps + #-pc_bddc_coarse_pc_type cholesky +-#-pc_bddc_coarse_pc_factor_mat_solver_package mumps ++#-pc_bddc_coarse_pc_factor_mat_solver_type mumps +diff --git a/examples/petsc/rc_ex4p b/examples/petsc/rc_ex4p +index f734f35fe..64fbe9427 100644 +--- a/examples/petsc/rc_ex4p ++++ b/examples/petsc/rc_ex4p +@@ -2,4 +2,4 @@ + # it needs PETSc configured with MUMPS + + -solver_pc_type cholesky +--solver_pc_factor_mat_solver_package mumps ++-solver_pc_factor_mat_solver_type mumps +diff --git a/examples/petsc/rc_ex4p_bddc b/examples/petsc/rc_ex4p_bddc +index 9507ad431..e8ef99db7 100644 +--- a/examples/petsc/rc_ex4p_bddc ++++ b/examples/petsc/rc_ex4p_bddc +@@ -13,7 +13,7 @@ + #-pc_bddc_adaptive_threshold 10 + + # Customization of the local solvers +-#-pc_bddc_neumann_pc_factor_mat_solver_package mumps +-#-pc_bddc_dirichlet_pc_factor_mat_solver_package mumps ++#-pc_bddc_neumann_pc_factor_mat_solver_type mumps ++#-pc_bddc_dirichlet_pc_factor_mat_solver_type mumps + #-pc_bddc_coarse_pc_type cholesky +-#-pc_bddc_coarse_pc_factor_mat_solver_package mumps ++#-pc_bddc_coarse_pc_factor_mat_solver_type mumps +diff --git a/examples/petsc/rc_ex5p_bddc b/examples/petsc/rc_ex5p_bddc +index b243c53c8..a4bc899c3 100644 +--- a/examples/petsc/rc_ex5p_bddc ++++ b/examples/petsc/rc_ex5p_bddc +@@ -28,13 +28,13 @@ + # local solvers (needs PETSc compiled with support for SuiteSparse) + # default solvers will fail + -prec_pc_bddc_neumann_pc_type lu +--prec_pc_bddc_neumann_pc_factor_mat_solver_package umfpack ++-prec_pc_bddc_neumann_pc_factor_mat_solver_type umfpack + -prec_pc_bddc_dirichlet_pc_type lu +--prec_pc_bddc_dirichlet_pc_factor_mat_solver_package umfpack ++-prec_pc_bddc_dirichlet_pc_factor_mat_solver_type umfpack + + # coarse solver (needs PETSc compiled with support for MUMPS) + # default solver may fail +--prec_pc_bddc_coarse_pc_factor_mat_solver_package mumps ++-prec_pc_bddc_coarse_pc_factor_mat_solver_type mumps + -prec_pc_bddc_coarse_pc_type cholesky + + # deluxe scaling (needs PETSc compiled with support for MUMPS) diff --git a/var/spack/repos/builtin/packages/mfem/mfem-3.4.patch b/var/spack/repos/builtin/packages/mfem/mfem-3.4.patch new file mode 100644 index 0000000000..465e0525ea --- /dev/null +++ b/var/spack/repos/builtin/packages/mfem/mfem-3.4.patch @@ -0,0 +1,36 @@ +diff --git a/config/test.mk b/config/test.mk +index 4821b084d..62479fc63 100644 +--- a/config/test.mk ++++ b/config/test.mk +@@ -14,11 +14,13 @@ + # Colors used below: + # green '\033[0;32m' + # red '\033[0;31m' ++# yellow '\033[0;33m' + # no color '\033[0m' + COLOR_PRINT = if [ -t 1 ]; then \ + printf $(1)$(2)'\033[0m'$(3); else printf $(2)$(3); fi + PRINT_OK = $(call COLOR_PRINT,'\033[0;32m',OK," ($$1 $$2)\n") + PRINT_FAILED = $(call COLOR_PRINT,'\033[0;31m',FAILED," ($$1 $$2)\n") ++PRINT_SKIP = $(call COLOR_PRINT,'\033[0;33m',SKIP,"\n") + + # Timing support + define TIMECMD_detect +diff --git a/examples/pumi/makefile b/examples/pumi/makefile +index 2f98eeca7..5ff652aca 100644 +--- a/examples/pumi/makefile ++++ b/examples/pumi/makefile +@@ -51,6 +51,13 @@ endif + MFEM_TESTS = EXAMPLES + include $(MFEM_TEST_MK) + ++ifneq (,$(filter test%,$(MAKECMDGOALS))) ++ ifeq (,$(wildcard ../../data/pumi)) ++ $(info PUMI data directory not found. The PUMI tests will be SKIPPED.) ++ mfem-test = printf " $(3) [$(2) $(1) ... ]: "; $(PRINT_SKIP) ++ endif ++endif ++ + # Testing: Parallel vs. serial runs + RUN_MPI_NP = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) + RUN_MPI = $(RUN_MPI_NP) $(MFEM_MPI_NP) diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py index 4ad659d16b..c32e1f622a 100644 --- a/var/spack/repos/builtin/packages/mfem/package.py +++ b/var/spack/repos/builtin/packages/mfem/package.py @@ -65,11 +65,15 @@ class Mfem(Package): version('develop', git='https://github.com/mfem/mfem', branch='master') - version('3.3.2', - '01a762a5d0a2bc59ce4e2f59009045a4', - url='https://goo.gl/Kd7Jk8', extension='.tar.gz', + version('3.4.0', + '4e73e4fe0482636de3c5dc983cd395839a83cb16f6f509bd88b053e8b3858e05', + url='https://bit.ly/mfem-3-4', extension='.tar.gz', preferred=True) + version('3.3.2', + 'b70fa3c5080b9ec514fc05f4a04ff74322b99ac4ecd6d99c229f0ed5188fc0ce', + url='https://goo.gl/Kd7Jk8', extension='.tar.gz') + version('laghos-v1.0', git='https://github.com/mfem/mfem', tag='laghos-v1.0') @@ -117,6 +121,8 @@ class Mfem(Package): description='Enable PETSc solvers, preconditioners, etc.') variant('sundials', default=False, description='Enable Sundials time integrators') + variant('pumi', default=False, + description='Enable functionality based on PUMI') variant('mpfr', default=False, description='Enable precise, 1D quadrature rules') variant('lapack', default=False, @@ -152,6 +158,7 @@ class Mfem(Package): conflicts('+mpfr', when='@:3.2') conflicts('+petsc', when='@:3.2') conflicts('+sundials', when='@:3.2') + conflicts('+pumi', when='@:3.3.2') conflicts('timer=mac', when='@:3.3.0') conflicts('timer=mpi', when='@:3.3.0') conflicts('~metis+mpi', when='@:3.3.0') @@ -160,8 +167,11 @@ class Mfem(Package): conflicts('+superlu-dist', when='~mpi') conflicts('+petsc', when='~mpi') + conflicts('+pumi', when='~mpi') conflicts('timer=mpi', when='~mpi') + conflicts('+pumi', when='+shared') + depends_on('mpi', when='+mpi') depends_on('hypre@2.10.0:2.13.999', when='@:3.3.999+mpi') depends_on('hypre', when='@3.4:+mpi') @@ -174,6 +184,7 @@ class Mfem(Package): depends_on('sundials@2.7.0+mpi+hypre', when='@:3.3.0+sundials+mpi') depends_on('sundials@2.7.0:', when='@3.3.2:+sundials~mpi') depends_on('sundials@2.7.0:+mpi+hypre', when='@3.3.2:+sundials+mpi') + depends_on('pumi', when='+pumi') depends_on('suite-sparse', when='+suite-sparse') depends_on('superlu-dist', when='+superlu-dist') # The PETSc tests in MFEM will fail if PETSc is not configured with @@ -192,6 +203,9 @@ class Mfem(Package): depends_on('conduit+mpi', when='+conduit+mpi') patch('mfem_ppc_build.patch', when='@3.2:3.3.0 arch=ppc64le') + patch('mfem-3.4.patch', when='@3.4.0') + patch('mfem-3.3-3.4-petsc-3.9.patch', + when='@3.3.0:3.4.0,develop +petsc ^petsc@3.9.0:') phases = ['configure', 'build', 'install'] @@ -226,6 +240,15 @@ class Mfem(Package): flags += ['-l%s' % lib for lib in pkg_libs_list] return ' '.join(flags) + def find_optional_library(name, prefix): + for shared in [True, False]: + for path in ['lib64', 'lib']: + lib = find_libraries(name, join_path(prefix, path), + shared=shared, recursive=False) + if lib: + return lib + return LibraryList([]) + metis5_str = 'NO' if ('+metis' in spec) and spec['metis'].satisfies('@5:'): metis5_str = 'YES' @@ -248,6 +271,7 @@ class Mfem(Package): 'MFEM_USE_SUITESPARSE=%s' % yes_no('+suite-sparse'), 'MFEM_USE_SUNDIALS=%s' % yes_no('+sundials'), 'MFEM_USE_PETSC=%s' % yes_no('+petsc'), + 'MFEM_USE_PUMI=%s' % yes_no('+pumi'), 'MFEM_USE_NETCDF=%s' % yes_no('+netcdf'), 'MFEM_USE_MPFR=%s' % yes_no('+mpfr'), 'MFEM_USE_GNUTLS=%s' % yes_no('+gnutls'), @@ -318,6 +342,9 @@ class Mfem(Package): 'PETSC_LIB=%s' % ld_flags_from_LibraryList(spec['petsc'].libs)] + if '+pumi' in spec: + options += ['PUMI_DIR=%s' % spec['pumi'].prefix] + if '+netcdf' in spec: options += [ 'NETCDF_OPT=-I%s' % spec['netcdf'].prefix.include, @@ -349,11 +376,7 @@ class Mfem(Package): libunwind = spec['libunwind'] headers = find_headers('libunwind', libunwind.prefix.include) headers.add_macro('-g') - libs = find_libraries('libunwind', libunwind.prefix.lib, - shared=True, recursive=True) - if not libs: - libs = find_libraries('libunwind', libunwind.prefix.lib, - shared=False, recursive=True) + libs = find_optional_library('libunwind', libunwind.prefix) # When mfem uses libunwind, it also needs 'libdl'. libs += LibraryList(find_system_libraries('libdl')) options += [ diff --git a/var/spack/repos/builtin/packages/mfem/test_builds.sh b/var/spack/repos/builtin/packages/mfem/test_builds.sh index 5b8dd7ba0f..b7d3d881b3 100755 --- a/var/spack/repos/builtin/packages/mfem/test_builds.sh +++ b/var/spack/repos/builtin/packages/mfem/test_builds.sh @@ -5,7 +5,7 @@ builds=( 'mfem' 'mfem~mpi~metis~gzstream' 'mfem+mpi+superlu-dist+suite-sparse+petsc \ - +sundials+mpfr+netcdf+gzstream+gnutls+libunwind \ + +sundials+pumi+mpfr+netcdf+gzstream+gnutls+libunwind \ ^hypre~internal-superlu ^petsc~boost+suite-sparse+mumps' 'mfem~mpi+suite-sparse+sundials+mpfr+netcdf \ +gzstream+gnutls+libunwind' @@ -14,6 +14,7 @@ builds=( 'mfem@develop+shared~static~mpi~metis~gzstream' # TODO: Replace '^conduit~python~hdf5' with '^conduit~python' when conduit # is fixed to accept '^hdf5+mpi'. + # NOTE: Skip PUMI since it conflicts with '+shared'. 'mfem@develop+shared~static+mpi \ +superlu-dist+suite-sparse+petsc+sundials+mpfr+netcdf+gzstream \ +gnutls+libunwind+conduit ^hypre~internal-superlu \ @@ -32,6 +33,7 @@ builds2=( 'mfem+suite-sparse' 'mfem+sundials~mpi' 'mfem+sundials' + 'mfem+pumi' 'mfem+netcdf~mpi' 'mfem+netcdf' 'mfem+mpfr' @@ -43,6 +45,7 @@ builds2=( 'mfem@develop+suite-sparse' 'mfem@develop+sundials~mpi' 'mfem@develop+sundials' + 'mfem@develop+pumi' 'mfem@develop+netcdf~mpi' 'mfem@develop+netcdf' 'mfem@develop+mpfr' -- cgit v1.2.3-70-g09d2