forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add package for feelpp
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
from spack.package import * | ||
|
||
class Feelpp(CMakePackage): | ||
""" | ||
Feel++ is an Open-Source C++ library designed to solve a wide range of partial differential equations (PDEs) using advanced Galerkin methods. | ||
These methods include the finite element method (FEM), spectral element method, discontinuous Galerkin methods, and reduced basis methods. | ||
Feel++ is optimized for high-performance computing, enabling seamless parallel computing on large-scale systems, ranging from desktop machines to supercomputers with tens of thousands of cores. | ||
The library supports multi-physics simulations and provides a modular structure to simplify the development of applications. | ||
Key Features: | ||
- **Toolboxes**: Predefined toolboxes for common PDE problems, enabling faster development and deployment of complex simulations. These toolboxes include: | ||
- **Coefficient Form PDEs**: For general PDEs in coefficient form. | ||
- **Computational Solid Mechanics**: For simulations of solid mechanics problems. | ||
- **Computational Fluid Mechanics**: For solving fluid dynamics problems. | ||
- **Heat Transfer**: For heat conduction and convection problems. | ||
- **Heat & Fluid**: Coupled heat and fluid dynamics simulations. | ||
- **Fluid Structure Interaction (FSI)**: For problems involving interactions between fluid flow and structural mechanics. | ||
- **Electric**: For solving electric field and current problems. | ||
- **Thermo-Electric**: For coupled thermoelectric simulations. | ||
- **Maxwell**: For simulating electromagnetic field problems based on Maxwell's equations. | ||
- **Hybridized Discontinuous Galerkin**: For high-order accurate discontinuous Galerkin methods with hybridization techniques. | ||
- **Model Order Reduction (MOR)**: Provides efficient techniques for reducing the computational complexity of large-scale simulations, enabling faster simulations while maintaining accuracy. | ||
- **Python Wrappers**: Python bindings allow for seamless integration of Feel++ functionalities into Python-based workflows, enabling rapid prototyping, interactive simulations, and data visualization. | ||
- **High-Performance Computing (HPC)**: Fully optimized for distributed (MPI) and shared-memory (multithread) parallelism, Feel++ can efficiently scale from small multi-core systems to large HPC clusters. | ||
- **C++ Standards**: Support for C++17, C++20, and C++23 standards, allowing users to leverage modern language features and optimizations. | ||
- **Extensive Scientific Libraries Integration**: Feel++ integrates with major scientific computing libraries, including PETSc, SLEPc, Boost, FFTW, and others, to extend its functionality and scalability. | ||
Optional Variants: | ||
- **+toolboxes**: Enable specialized toolboxes for common PDEs, such as fluid mechanics, solid mechanics, and coupled heat and fluid simulations. | ||
- **+mor**: Enable Model Order Reduction (MOR) for computationally expensive large-scale systems. | ||
- **+python**: Enable Python bindings to allow Python-based interaction with Feel++. | ||
- **+quickstart**: Enable quickstart examples for easier onboarding and usage. | ||
- **+tests**: Enable tests to verify the integrity of the Feel++ installation. | ||
- **cpp17/cpp20/cpp23**: Choose the C++ standard (C++17, C++20, or C++23) for compilation. | ||
""" | ||
|
||
|
||
homepage = "https://docs.feelpp.org" | ||
url = "https://github.com/feelpp/feelpp/archive/v0.110.2.tar.gz" | ||
git = "https://github.com/feelpp/feelpp.git" | ||
|
||
license("LGPL-3.0-or-later AND GPL-3.0-or-later") | ||
maintainers( "prudhomm", "vincentchabannes" ) | ||
|
||
version('develop', branch='develop') | ||
version('preset', branch='2284-add-spack-environment-to-the-main-ci') | ||
|
||
# Define variants | ||
variant('toolboxes', default=False, description="Enable the Feel++ toolboxes") | ||
variant('mor', default=False, description="Enable Model Order Reduction (MOR)") | ||
variant('python', default=False, description="Enable Python wrappers") | ||
variant('quickstart', default=False, description="Enable the quickstart examples") | ||
variant('tests', default=False, description="Enable the tests") | ||
|
||
# Add variants for C++ standards | ||
variant('cpp17', default=False, description="Use C++17 standard") | ||
variant('cpp20', default=True, description="Use C++20 standard") | ||
variant('cpp23', default=False, description="Use C++23 standard") | ||
|
||
# Define conflicts between the C++ standard variants | ||
conflicts('+cpp17', when='+cpp20', msg="Cannot enable both C++17 and C++20") | ||
conflicts('+cpp17', when='+cpp23', msg="Cannot enable both C++17 and C++23") | ||
conflicts('+cpp20', when='+cpp23', msg="Cannot enable both C++20 and C++23") | ||
|
||
|
||
# Specify dependencies with the required versions | ||
depends_on('[email protected]:', type='build') # Require CMake > 3.21 | ||
depends_on('[email protected]: +regex+date_time+filesystem+iostreams+mpi+multithreaded+program_options+serialization+shared+system+test') | ||
depends_on('[email protected] +mumps+hwloc+ptscotch +suite-sparse+hdf5 +hypre+kokkos') | ||
depends_on('llvm@18:',type='build') # Require LLVM (Clang) version 18 or higher | ||
depends_on('slepc') | ||
depends_on('mpi') | ||
depends_on('[email protected]') | ||
depends_on('fftw') | ||
depends_on('libunwind') | ||
depends_on('libzip') | ||
depends_on('bison') | ||
depends_on('flex') | ||
depends_on('pugixml') | ||
depends_on('gsl') | ||
depends_on('glpk') | ||
depends_on('gl2ps') | ||
depends_on('ruby') | ||
depends_on('gmsh +opencascade+mmg+fltk') | ||
depends_on('ruby') | ||
depends_on('curl') | ||
|
||
|
||
|
||
|
||
# Python dependencies if +python variant is enabled | ||
depends_on('py-pytest', when='+python') | ||
depends_on('py-pandas', when='+python') | ||
depends_on('py-petsc4py', when='+python') | ||
depends_on('py-slepc4py', when='+python') | ||
depends_on('py-numpy', when='+python') | ||
depends_on('py-pybind11', when='+python') | ||
depends_on('py-sympy', when='+python') | ||
depends_on('py-plotly', when='+python') | ||
depends_on('py-scipy', when='+python') | ||
depends_on('py-tabulate', when='+python') | ||
depends_on('py-ipykernel', when='+python') | ||
depends_on('py-mpi4py', when='+python') | ||
depends_on('[email protected]:', when='+python', type=('build', 'run')) | ||
|
||
def get_cpp_version(self): | ||
"""Helper function to determine the C++ standard preset.""" | ||
if '+cpp17' in self.spec: | ||
return 'cpp17' | ||
elif '+cpp20' in self.spec: | ||
return 'cpp20' | ||
elif '+cpp23' in self.spec: | ||
return 'cpp17' | ||
else: | ||
return 'cpp20' # default | ||
|
||
def get_preset_name(self): | ||
cpp_version = self.get_cpp_version() | ||
preset_name = f'feelpp-clang-{cpp_version}-default-release' | ||
return preset_name | ||
|
||
def cmake_args(self): | ||
"""Define the CMake preset and CMake options based on variants""" | ||
|
||
# Add options based on the variants | ||
args = [ | ||
f'--preset={self.get_preset_name()}', | ||
self.define_from_variant("FEELPP_ENABLE_QUICKSTART", "quickstart"), | ||
self.define_from_variant("FEELPP_ENABLE_TESTS", "tests"), | ||
self.define_from_variant("FEELPP_ENABLE_TOOLBOXES", "toolboxes"), | ||
self.define_from_variant("FEELPP_ENABLE_MOR", "mor"), | ||
self.define_from_variant("FEELPP_ENABLE_FEELPP_PYTHON", "python"), | ||
] | ||
return args | ||
|
||
def build(self, spec, prefix): | ||
"""Override the default build command to use CMake presets.""" | ||
cmake = which('cmake') | ||
|
||
cmake('--build', '--preset', self.get_preset_name()) | ||
|
||
|
||
def install(self, spec, prefix): | ||
"""Override the default install command to use CMake presets.""" | ||
cmake = which('cmake') | ||
cmake('--build', '--preset', self.get_preset_name(), '-t', 'install') | ||
|
||
def test(self, spec, prefix): | ||
"""Override the default test command to use CMake presets.""" | ||
ctest = which('ctest') | ||
ctest('--preset', self.get_preset_name(), '-R', 'qs_laplacian') |