Peano
Loading...
Searching...
No Matches
package.py
Go to the documentation of this file.
1# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
2# Spack Project Developers. See the top-level COPYRIGHT file for details.
3#
4# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5
6import os
7
8import spack.variant
9from spack.package import *
10
11
12class Exahype2(CMakePackage, CudaPackage):
13 """ExaHyPE 2 - ExaHyPE is an open source simulation engine to solve
14 hyperbolic PDE systems. It is built on top of dynamically
15 adaptive Cartesian meshes and offers support for Finite Volume,
16 Runge-Kutta Discontinuous Galerkin and ADER-DG discretisations.
17 ExaHyPE is written in a way that most computer science aspects
18 as well as most of the numerics are hidden away from the user:
19 Users plug in user functions for their PDE formulation
20 (such as flux functions and eigenvalues) into the engine and
21 then delegate all further work to ExaHyPE.
22 """
23
24 homepage = "www.peano-framework.org"
25 url = "https://gitlab.lrz.de/hpcsoftware/Peano"
26 git = "https://gitlab.lrz.de/hpcsoftware/Peano.git"
27
28 maintainers("hpcsoftware")
29
30 version("muc", branch="muc/exahype")
31
32 variant("mpi", default=True, description="Build with MPI support")
33 variant("tracer", default=True, description="Build with particle tracer support")
34 variant("hdf5", default=True, description="Build with HDF5 support")
35 variant("netcdf", default=True, description="Build with NetCDF support")
36
37 depends_on("cmake@3.31.2")
38
39 depends_on("mpi", when="+mpi")
40
41 depends_on("python@3.13.0")
42 depends_on("py-pip@24.3.1")
43
44 depends_on("hdf5@1.14.5 -fortran -java +threadsafe ~mpi +shared +cxx +hl", when="~mpi +hdf5")
45 depends_on("hdf5@1.14.5 -fortran -java +threadsafe +mpi +shared +cxx +hl", when="+mpi +hdf5")
46
47 depends_on("netcdf-c@4.9.2 +shared ~mpi", when="~mpi +netcdf")
48 depends_on("netcdf-c@4.9.2 +shared +mpi", when="+mpi +netcdf")
49 depends_on("netcdf-cxx4@4.3.1 +shared +pic", when="+netcdf")
50
51 depends_on('gsl@2.8')
52 depends_on('libxsmm@1.17 +generator')
53
54 variant("omp", default=True, description="Build with OpenMP multithreading support")
55 variant("sycl", default=False, description="Build with SYCL multithreading support")
56 variant("cpp", default=False, description="Build with std::par multithreading support")
57 variant("tbb", default=False, description="Build with TBB multithreading support")
58
59 conflicts("+omp", when="+sycl", msg="OpenMP and SYCL support are exclusive")
60 conflicts("+omp", when="+cpp", msg="OpenMP and std::par support are exclusive")
61 conflicts("+sycl", when="+cpp", msg="SYCL and std::par support are exclusive")
62 conflicts("+tbb", when="+cpp", msg="TBB and std::par support are exclusive")
63 conflicts("+tbb", when="+sycl", msg="TBB and SYCL support are exclusive")
64 conflicts("+tbb", when="+omp", msg="TBB and OpenMP support are exclusive")
65
66 depends_on("cuda@11:", when="+cuda")
67
68 conflicts(
69 "cuda_arch=none",
70 when="+cuda",
71 msg="A value for cuda_arch must be specified. Add cuda_arch=XX",
72 )
73
74 variant(
75 "gpu_backend",
76 default="omp",
77 description="GPU accelerator backend",
78 values=("omp", "cpp", "sycl", "cuda"),
79 when="+cuda",
80 )
81
82
83 def cmake_args(self):
84 args = [
85 "-DENABLE_TOOLBOX_LOADBALANCING=ON",
86 "-DENABLE_TOOLBOX_BLOCKSTRUCTURED=ON",
87 "-DENABLE_EXTENSIONEXAHYPE=ON",
88 "-DWITH_LIBXSMM=OFF",
89 self.define_from_variant("WITH_MPI", "mpi"),
90 self.define_from_variant("WITH_HDF5", "hdf5"),
91 self.define_from_variant("WITH_NETCDF", "netcdf"),
92 self.define_from_variant("ENABLE_TOOLBOX_PARTICLES", "tracer"),
93 ]
94
95 if self.spec.satisfies("+omp"):
96 args.append("-DWITH_MULTITHREADING=omp")
97 if self.spec.satisfies("+cpp"):
98 args.append("-DWITH_MULTITHREADING=cpp")
99 if self.spec.satisfies("+sycl"):
100 args.append("-DWITH_MULTITHREADING=sycl")
101 if self.spec.satisfies("+tbb"):
102 args.append("-DWITH_MULTITHREADING=tbb")
103
104 if self.spec.satisfies("+cuda"):
105 cuda_arch = self.spec.variants["cuda_arch"].value[0]
106 gpu_backend = self.spec.variants["gpu_backend"].value
107 args.append(f"-DWITH_GPU={gpu_backend}")
108 args.append(f"-DWITH_GPU_ARCH=sm_{cuda_arch}")
109
110 return args
111
112
113 def install(self, spec, prefix):
114 super(Exahype2, self).install(spec, prefix)
115
116 python_exe = Executable(spec['python'].command.path)
117
118 requirements_path = join_path(self.stage.source_path, 'requirements.txt')
119 if os.path.exists(requirements_path):
120 python_exe('-m', 'pip', 'install', '--prefix=' + prefix, '-r', requirements_path)
121
122
123 def setup_run_environment(self, env):
124 env.set("PEANO_SRC_ROOT_DIR", self.spec.prefix)
125 env.set("PEANO_CMAKE_BUILD_DIR", self.spec.prefix)
126 env.prepend_path("PYTHONPATH", self.spec.prefix + "/python")
127 env.prepend_path("PYTHONPATH", join_path(self.spec.prefix, "lib", "python" + str(self.spec["python"].version.up_to(2)), "site-packages"))
ExaHyPE 2 - ExaHyPE is an open source simulation engine to solve hyperbolic PDE systems.
Definition package.py:12
setup_run_environment(self, env)
Definition package.py:123
cmake_args(self)
Definition package.py:83
install(self, spec, prefix)
Definition package.py:113