From 5cf7c60d74e1dd9b88c6559ac8ce9adf9d8b00c2 Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Wed, 5 Apr 2023 03:37:20 +0200 Subject: [PATCH] add tandem package (#36546) * add tandem package * apply black * fix import * fix year of license * add version 1.0 and associated compile fix * change git to property * add conflict to intel --- .../packages/tandem/fix_v1.0_compilation.diff | 29 ++++++++ .../repos/builtin/packages/tandem/package.py | 72 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 var/spack/repos/builtin/packages/tandem/fix_v1.0_compilation.diff create mode 100644 var/spack/repos/builtin/packages/tandem/package.py diff --git a/var/spack/repos/builtin/packages/tandem/fix_v1.0_compilation.diff b/var/spack/repos/builtin/packages/tandem/fix_v1.0_compilation.diff new file mode 100644 index 0000000000..841e028b57 --- /dev/null +++ b/var/spack/repos/builtin/packages/tandem/fix_v1.0_compilation.diff @@ -0,0 +1,29 @@ +diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt +index 515f15f..bc48092 100644 +--- a/app/CMakeLists.txt ++++ b/app/CMakeLists.txt +@@ -82,9 +82,9 @@ function(generate_code APP) + if("${YATETO_ARCH}" MATCHES "skl|naples|rome") + set(YATETO_ARCH "hsw") + endif() +- set(WITH_LIBXSMM "") ++ set(WITH_LIBXSMM "\'\'") + if(${LibxsmmGenerator_FOUND}) +- set(WITH_LIBXSMM ${LibxsmmGeneratorExecutable}) ++ set(WITH_LIBXSMM "\'${LibxsmmGeneratorExecutable}\'") + endif() + add_custom_command( + COMMAND +diff --git a/src/mesh/Simplex.h b/src/mesh/Simplex.h +index 6a2cf29..36b0be3 100644 +--- a/src/mesh/Simplex.h ++++ b/src/mesh/Simplex.h +@@ -7,7 +7,7 @@ + #include + #include + #include +- ++#include + #include "util/Combinatorics.h" + + namespace tndm { diff --git a/var/spack/repos/builtin/packages/tandem/package.py b/var/spack/repos/builtin/packages/tandem/package.py new file mode 100644 index 0000000000..bfd2f252c6 --- /dev/null +++ b/var/spack/repos/builtin/packages/tandem/package.py @@ -0,0 +1,72 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +from spack.package import * + + +class Tandem(CMakePackage): + """Tandem is a scientific software for SEAS modelling and for solving Poisson + and linear elasticity problems. It implements the Symmetric Interior Penalty + Galerkin (SIPG) method using unstructured simplicial meshes (triangle meshes + in 2D, tetrahedral meshes in 3D).""" + + homepage = "https://tandem.readthedocs.io/en/latest/" + git = "https://github.com/TEAR-ERC/tandem.git" + version("main", branch="main", submodules=True) + + # we cannot use the tar.gz file because it does not contains submodules + version("1.0", tag="v1.0", submodules=True) + patch("fix_v1.0_compilation.diff", when="@1.0") + + maintainers = ["dmay23", "Thomas-Ulrich"] + variant("polynomial_degree", default="2") + variant("domain_dimension", default="2", values=("2", "3"), multi=False) + variant("min_quadrature_order", default="0") + variant("libxsmm", default=False, description="installs libxsmm-generator") + + depends_on("mpi") + depends_on("parmetis +int64 +shared") + depends_on("metis +int64 +shared") + depends_on("libxsmm@1.17 +generator", when="+libxsmm target=x86_64:") + depends_on("lua@5.3.2:5.4.4") + depends_on("eigen@3.4.0") + depends_on("zlib@1.2.8:1.2.13") + depends_on("petsc@3.14.6:3.18.5 +int64 +mumps +scalapack") + depends_on("petsc@3.14.6:3.18.5 +int64 +mumps +scalapack +knl", when="target=skylake:") + # see https://github.com/TEAR-ERC/tandem/issues/45 + conflicts("%intel") + + def cmake_args(self): + args = [ + self.define_from_variant("DOMAIN_DIMENSION", "domain_dimension"), + self.define_from_variant("POLYNOMIAL_DEGREE", "polynomial_degree"), + self.define_from_variant("MIN_QUADRATURE_ORDER", "min_quadrature_order"), + ] + + arch_dic = {} + arch_dic["skylake"] = "skl" + arch_dic["skylake_avx512"] = "skx" + arch_dic["haswell"] = "hsw" + arch_dic["sandybridge"] = "snb" + arch_dic["zen2"] = "rome" + arch_dic["zen"] = "naples" + target = str(self.spec.target) + + if target in arch_dic: + args.append("-DARCH=" + arch_dic[target]) + else: + print(target, "not in arch list of tandem, using native") + args.append("-DARCH=native") + + return args + + def install(self, spec, prefix): + self.cmake(spec, prefix) + self.build(spec, prefix) + install_tree(self.build_directory, prefix) + + def setup_run_environment(self, env): + env.prepend_path("PATH", self.prefix.app)