Compare commits

...

47 Commits

Author SHA1 Message Date
Zhuo Yang 9ce73efd30 add version of 2.8 and 2.9 2024-11-23 21:23:46 +08:00
Dominic Kempf 7694364c69 dune-codegen now has a 2.7 release 2020-07-10 09:15:29 +00:00
Dominic Kempf e658e3ade6 Update README.md 2020-07-03 08:56:42 +00:00
Dominic Kempf 037967d152 [!26] Add patch for PDELab 2.6
Merge branch 'feature/2.6-release' into 'master'

ref:spack/dune-spack\> On release 2.6 PDELab had a very old requirement for
CMake and didn't allow to install the module properly. i.e. other modules were
not able to resolve its CMake targets correctly. This issue was solved for
release 2.7.

See merge request [spack/dune-spack!26]

  [spack/dune-spack!26]: gitlab.dune-project.org/spack/dune-spack/merge_requests/26
2020-07-03 08:55:34 +00:00
Santiago Ospina De Los Ríos 839e327f95 Add patch for PDELab 2.6
On release 2.6 PDELab had a very old requirement for CMake and didn't allow to install the module properly.
i.e. other modules where not able to resolve its CMake targets correctly. This issue was solved for release 2.7.
2020-07-03 08:55:34 +00:00
Dominic Kempf 81f74c4a22 [!25] Add a 2.6 release for the Dorie people
Merge branch 'feature/2.6-release' into 'master'

ref:spack/dune-spack\> This fixes [#17]

TODO:

-   [ ] Adjust README

See merge request [spack/dune-spack!25]

  [#17]: gitlab.dune-project.org/NoneNone/issues/17
  [spack/dune-spack!25]: gitlab.dune-project.org/spack/dune-spack/merge_requests/25


Closes #17
2020-07-03 08:54:42 +00:00
Dominic Kempf 4602670ff3 Add a 2.6 release for the Dorie people 2020-06-23 10:38:38 +02:00
Dominic Kempf 3eda19a5e8 dune-grod-glue now has a 2.7 release 2020-06-10 07:34:50 +00:00
Dominic Kempf 4807a17bab PDELab now has a releases/2.7 branch 2020-06-05 14:54:49 +00:00
Dominic Kempf 64ac5770a2 Change PDELab branch - the fix was merged. 2020-06-04 10:36:54 +00:00
Dominic Kempf 640fc04f6a [!24] Throw errors if unavailable versions are requested
Merge branch 'feature/errors-on-unavailable-versions' into 'master'

See merge request [spack/dune-spack!24]

  [spack/dune-spack!24]: Nonespack/dune-spack/merge_requests/24
2020-05-22 09:26:03 +00:00
Dominic Kempf 4e214973a6 Throw errors if unavailable versions are requested 2020-05-22 11:24:38 +02:00
Dominic Kempf 2a8b5e620e remove pwd from CI script 2020-05-22 08:41:46 +00:00
Dominic Kempf 6a2b479e67 Add closing bracket in README 2020-05-22 08:41:01 +00:00
Dominic Kempf 21797df1cc [!23] Respect the build type variant added by the CMakePackage class
Merge branch 'feature/respect-build-type-variant' into 'master'

ref:spack/dune-spack\> Fixes [#16]

See merge request [spack/dune-spack!23]

  [#16]: gitlab.dune-project.org/NoneNone/issues/16
  [spack/dune-spack!23]: gitlab.dune-project.org/spack/dune-spack/merge_requests/23


Closes #16
2020-05-22 08:35:06 +00:00
Dominic Kempf d2b223e38c Respect the build type variant added by the CMakePackage class 2020-05-22 10:33:47 +02:00
Dominic Kempf 7000023d52 Remove some outdated variables 2020-05-20 14:36:03 +00:00
Dominic Kempf c72ed761a5 Remove SIONLib dependency - the package does not yet exist 2020-05-20 14:31:43 +00:00
Dominic Kempf c9f64603f6 spack clear -> clean 2020-05-20 14:10:50 +00:00
Dominic Kempf a965459eb2 Typo 2020-05-20 14:07:22 +00:00
Dominic Kempf 3c53d4211b [!22] Rewrite README with a lot of useful information
Merge branch 'feature/readme' into 'master'

See merge request [spack/dune-spack!22]

  [spack/dune-spack!22]: Nonespack/dune-spack/merge_requests/22
2020-05-20 14:06:22 +00:00
Dominic Kempf 70b6ef347d Rewrite README with a lot of useful information 2020-05-20 16:05:05 +02:00
Dominic Kempf ba1a1010bd [!21] Change iteration variable names to avoid clashes with the rest of Spack
Merge branch 'bugfix/iteration-variables' into 'master'

ref:spack/dune-spack\> Spack's weird overall architecture makes temporary
variables in the package scope really dangerous. In my case, an iteration
variable 'module' caused the perl package to fall over\...

See merge request [spack/dune-spack!21]

  [spack/dune-spack!21]: gitlab.dune-project.org/spack/dune-spack/merge_requests/21
2020-05-20 09:21:49 +00:00
Dominic Kempf 8c3ebdf0f1 Change iteration variable names to avoid clashes with the rest of Spack
Spack's weird overall architecture makes temporary variables in the
package scope really dangerous. In my case, an iteration variable
'module' caused the perl package to fall over...
2020-05-20 11:19:48 +02:00
Dominic Kempf 1d258a75d6 [!20] Reduce the number of variants for upstream dependencies
Merge branch 'feature/reduce-variants' into 'master'

ref:spack/dune-spack\> I really do not see much value in e.g. having a switch
to build without BLAS. Instead, cheap upstream dependencies are always built
and expensive ones have a variant. This reduces variant bloat.

See merge request [spack/dune-spack!20]

  [spack/dune-spack!20]: gitlab.dune-project.org/spack/dune-spack/merge_requests/20
2020-05-20 08:29:19 +00:00
Dominic Kempf bc6b155a39 Reduce the number of variants for upstream dependencies
I really do not see much value in e.g. having a switch to build
without BLAS. Instead, cheap upstream dependencies are always built
and expensive ones have a variant. This reduces variant bloat.
2020-05-20 09:52:55 +02:00
Dominic Kempf ce341af06e [!19] Introduce variant dependency
Merge branch 'feature/variant-dependencies' into 'master'

ref:spack/dune-spack\> The previous approach had the big downside of bypassing
the specified variants through the specified dependencies of variants. E.g.
dune+pdelab~functions would silently ignore the ~functions aspect, because
+pdelab enforces the installation of dune-functions. This introduces even more
subtle bugs as more Dune modules are added to the package as any
Dune-module-dependent logic in the package needs to be duplicated for each
Dune module that depends on the module that originally introduced that logic
(yuck!).

There is no direct mechanism in Spack to specify such dependencies in a way
that enforces the correct variants on dependent modules. I have now added
conflicts between variants that reflect the Dune module dependencies. In that
case dune+pdelab~functions would throw an error.

This comes at the cost that a command such as

    spack install dune+pdelab

is not possible anymore. Instead the user needs to specify the dependent
modules as well:

    spack install dune+pdelab+functions+typetree

Note that in order to remove some burden from users, I removed the variants
for the core modules - they are always installed.

See merge request [spack/dune-spack!19]

  [spack/dune-spack!19]: gitlab.dune-project.org/spack/dune-spack/merge_requests/19
2020-05-20 07:32:17 +00:00
Dominic Kempf c930ddd5f0 Introduce variant dependency
The previous approach had the big downside of bypassing
the specified variants through the specified dependencies
of variants. E.g. dune+pdelab~functions would silently ignore
the ~functions aspect, because +pdelab enforces the installation
of dune-functions.

There is no direct mechanism in Spack to specify such
dependencies in a way that enforces the correct variants
on dependent modules. I have now added conflicts between variants
that reflect the Dune module dependencies. In that case
dune+pdelab~functions would throw an error.

This comes at the cost that a command such as
spack install dune+pdelab
is not possible anymore. Instead the user needs to specify
the dependent modules as well:
spack install dune+pdelab+functions+typetree
Note that in order to remove some burden from users,
I removed the variants for the core modules - they are always
installed.
2020-05-19 16:11:46 +02:00
Dominic Kempf d74cbb85a8 [!18] Make iteration order of versions deterministic to ensure default version
Merge branch 'feature/deterministic-version' into 'master'

See merge request [spack/dune-spack!18]

  [spack/dune-spack!18]: Nonespack/dune-spack/merge_requests/18
2020-05-19 12:55:42 +00:00
Dominic Kempf bcecb661e0 Make iteration order of versions deterministic to ensure default version 2020-05-19 14:54:15 +02:00
Dominic Kempf 282c955e21 [!17] Add dune-fem to the Spack package
Merge branch 'feature/dune-fem' into 'master'

See merge request [spack/dune-spack!17]

  [spack/dune-spack!17]: Nonespack/dune-spack/merge_requests/17
2020-05-19 12:47:03 +00:00
Dominic Kempf c7eb0ed0b5 Add dune-fem to the Spack package 2020-05-19 14:45:48 +02:00
Dominic Kempf d994639581 [!16] Add some easy to implement Dune modules to the Spack package
Merge branch 'feature/easy-modules' into 'master'

See merge request [spack/dune-spack!16]

  [spack/dune-spack!16]: Nonespack/dune-spack/merge_requests/16
2020-05-19 11:58:54 +00:00
Dominic Kempf 4dbf9e9e27 Add some easy to implement Dune modules to the Spack package 2020-05-19 13:57:43 +02:00
Dominic Kempf e75d5fefeb [!15] Add dune-codegen to the dune package
Merge branch 'feature/dune-codegen' into 'master'

See merge request [spack/dune-spack!15]

  [spack/dune-spack!15]: Nonespack/dune-spack/merge_requests/15
2020-05-19 10:45:48 +00:00
Dominic Kempf 7af542f4ab Add dune-codegen to the dune package 2020-05-19 12:44:15 +02:00
Dominic Kempf ee1e6a82a6 [!14] Add dune-pdelab to the Spack package
Merge branch 'feature/dune-pdelab' into 'master'

See merge request [spack/dune-spack!14]

  [spack/dune-spack!14]: Nonespack/dune-spack/merge_requests/14
2020-05-18 11:40:28 +00:00
Dominic Kempf 7519e4aeec Add dune-pdelab to the Spack package 2020-05-18 13:39:12 +02:00
Dominic Kempf 493d25b065 [!13] Make sure that the python directories are in the user space
Merge branch 'feature/user-space-python-directories' into 'master'

See merge request [spack/dune-spack!13]

  [spack/dune-spack!13]: Nonespack/dune-spack/merge_requests/13
2020-05-18 11:00:04 +00:00
Dominic Kempf ae26fb1603 Make sure we use Python3 in testing Docker container 2020-05-18 12:52:30 +02:00
Dominic Kempf aaf522074b Make sure that the python directories are in the user space 2020-05-18 12:42:46 +02:00
Dominic Kempf b367fafaf5 [!12] Remove patch for executable scripts - it is in dune-common now
Merge branch 'feature/dune-testtools' into 'master'

See merge request [spack/dune-spack!12]

  [spack/dune-spack!12]: Nonespack/dune-spack/merge_requests/12
2020-05-18 10:01:27 +00:00
Dominic Kempf 3befb49555 Fixup 2020-05-18 12:00:26 +02:00
Dominic Kempf bf9c03263f Remove patch for executable scripts - it is in dune-common now 2020-05-18 11:58:16 +02:00
Dominic Kempf 2208a7ed92 [!11] Add dune-testtools to the repository
Merge branch 'feature/dune-testtools' into 'master'

ref:spack/dune-spack\> This module is special as it works with the Dune
virtualenv.

See merge request [spack/dune-spack!11]

  [spack/dune-spack!11]: gitlab.dune-project.org/spack/dune-spack/merge_requests/11
2020-05-15 19:01:12 +00:00
Dominic Kempf a71f2f7bc1 Fix dune-common patch such that it works also on first run 2020-05-15 20:58:09 +02:00
Dominic Kempf f42ced7562 Add a dune-testtools resource to the package 2020-05-15 15:12:12 +02:00
6 changed files with 435 additions and 161 deletions

View File

@ -1,7 +1,6 @@
---
before_script:
- pwd
- . /spack/share/spack/setup-env.sh
- spack repo add .

View File

@ -11,8 +11,8 @@ RUN export DEBIAN_FRONTEND=noninteractive; \
ca-certificates \
git \
procps \
python \
python-dev \
python3 \
python3-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
ARG version=master

155
README.md
View File

@ -1,56 +1,139 @@
# DISCLAIMER
This repository is in early experimental stage. As soon as it is mature,
this disclaimer will be removed and the project will be publicly announced
through the mailing list. Until then, you are invited to try this and report
your experiences, but you might experience some problems.
This repository is in early experimental stage. As soon as it is mature, this disclaimer will be removed and the project will be publicly announced through the mailing list. Until then, you are invited to try this and report your experiences, but you might experience some problems.
# Dune Spack repository
## Installation
Clone spack git
This repository defines a package `dune` for the Spack package manager. It allows to install the Dune core modules and many extension modules, as well as their dependent software with very few commands. The target audiences for Spack are:
* system administrators at HPC facilities that build scientific software stacks
* developers that are interested in OS-independent, consistent software stacks for their development
* new users that are interested in minimal installation procedures
More information on Spack can be found [in the official documentation](https://spack.readthedocs.io/en/latest/index.html).
The below instructions should explain the basics of Spack usage though.
## Prerequisites
Spack requires the following packages on the system:
* a C++ compiler
* a Python interpreter
* `make`
* `git`
* `curl`
If you are running Ubuntu or Debian, the following command will install the necessary requirements:
```
sudo apt-get install build-essential git curl python3
```
## Setting up Spack for Dune
The first step is to get the Spack sources via `git`:
```
git clone https://github.com/spack/spack.git
source ./share/spack/setup-env.sh
spack bootstrap
```
add dune spack repo
```
cd $HOME
git clone https://github.com/gauthier12/dune_spack_repo.git
spack repo add dune_spack_repo
```
Install dune with desired modules
```
spack install dune+desired+modules+.....
```
by example
```
spack install dune+uggrid+grid+functions
```
modules dependencies wil be automatically downloaded and added
## Use
To use dune, load the module
Then, you should add Spack to your shell environment:
```
source <path-to-spack>/share/spack/setup-env.sh
```
This commmand needs to be rerun on any shell session, so you might want to consider adding it to your `~/.bashrc`.
Next, the dune-spack repository needs to be added to Spack's library of package specifications:
```
git clone https://gitlab.dune-project.org/spack/dune-spack.git
spack repo add dune-spack
```
## Installing Dune!
You are now good to install Dune:
```
spack install dune
```
This will install the latest release of the Dune core modules and all their dependencies. As Spack builds the entire dependency tree from source, this might take up to several hours. Also, this operation requires internet access as tarballs are fetched from the internet during the installation process (if you are in an isolated network environment, you should consult the Spack documentation).
After installation, the package can be loaded into the environment with:
```
source /PATH/TO/SPACK/share/spack/setup-env.sh
spack load dune
```
if python module was installed, python bindings are avalaible after loading the module
## Build a new module
### Load the dune module
## Customization of the Dune package
There is two main points about the Dune package that can be customized: *versions* and *variants*.
A summary of customization options can be shown with:
```
source /PATH/TO/SPACK/share/spack/setup-env.sh
spack info dune
```
Currently, three versions are implemented: `master`, `2.7` (default) and `2.6`. You can switch between them by specifying them with the `@` character. The following command installs a software stack based on the master branch of all Dune modules:
```
spack install dune@master
```
Variants describe optional components of Dune and are appended to the package name with the `+` character e.g. `dune+uggrid`. Again, a complete list of available variants is available with `spack info dune`. You can also inspect the DAG of the software stack that is going to be installed beforehand by running e.g.:
```
spack spec dune+fem+python
```
This will also throw a meaningful error message in case you requested an incompatible set of variants.
Note that it is possible to install the Dune package multiple times with differing versions and variants. When loading the Dune package, you need to identify the version you are loading by providing versions and variants or through Spack's build hash.
## Using the installed Dune package
Whenever you want to use the Spack-installed Dune, you need to make sure that you have `source`d Spack's setup script and loaded your Dune package:
```
source <path-to-spack>/share/spack/setup-env.sh
spack load dune
```
### Initialize dune project
```
duneproject
```
Answer the questions about the new modules, enter the project folder and compile with standard cmake
If you now have any Dune module dune-foo you can simply run:
```
cd dune-foo
mkdir build
cd build
cmake ..
cmake --build .
```
There is no need to run `dunecontrol`, a plain `cmake` call will correctly configure your module `dune-foo`. If you want to create a new module, you can do so by calling:
```
duneproject
```
If you are interested in using the Python bindings for Dune, you should make sure to build with the `+python` variant. After loading the Dune module, you can run the Python interpreter and immediately run Python examples. For convenience, you might want to consider installing and loading additional tools though, e.g.:
```
spack install jupyter
spack load jupyter
```
## Troubleshooting
Spack is a great tool, but sometimes things may fall over. These are the equivalents of *Have you tried turning it off an on again?* for Spack:
* Uninstall all versions of the Dune package: `spack uninstall dune`
* Clear all build caches `spack clean -a`
* Remove `$HOME/.spack` (note you need to re-add the Dune repository afterwards: `spack repo add <path-to-dune-spack>`)
If your problem persists, report it on [the issue tracker](https://gitlab.dune-project.org/spack/dune-spack/issues).
A complete log of what is going on would be very much appreciated.
## Acknowledgements
Thank you to Gauthier Foltan for providing very useful hints and implementation on how to map Dune's multi-modular structure to Spack's abstractions.

View File

@ -21,6 +21,7 @@
# ----------------------------------------------------------------------------
import os
from pathlib import Path
from spack import *
@ -32,12 +33,73 @@ class Dune(CMakePackage):
git = "https://gitlab.dune-project.org/core/dune-common.git"
# This defines a mapping of available versions of the dune Spack package
# and the branch name in the Dune repositories this refers to.
dune_versions_to_branch = {
"master" : "master",
"2.7" : "releases/2.7",
# and the branch name in the Dune repositories this refers to. This is a
# list instead of a dictionary to ensure iteration order (first entry is
# the default version) in Python3.
dune_versions_to_branch = [
("2.9", "releases/2.9"),
("2.8", "releases/2.8"),
("2.7", "releases/2.7"),
("2.6", "releases/2.6"),
("master" , "master"),
]
# This defines the mapping of the variant names for Dune modules and the
# resource names that we assign later on.
dune_variants_to_resources = {
'alugrid' : 'dune-alugrid',
'codegen' : 'dune-codegen',
'fem' : 'dune-fem',
'foamgrid' : 'dune-foamgrid',
'functions': 'dune-functions',
'gridglue' : 'dune-grid-glue',
'multidomaingrid' : 'dune-multidomaingrid',
'pdelab' : 'dune-pdelab',
'polygongrid' : 'dune-polygongrid',
'spgrid' : 'dune-spgrid',
'testtools' : 'dune-testtools',
'typetree' : 'dune-typetree',
'uggrid' : 'dune-uggrid',
}
# Define the inverse mapping
dune_resources_to_variants = {v: k for k, v in dune_variants_to_resources.items()}
# Dependencies between modules - not necessarily the full set
# as the closure of module dependencies is built later on.
# dune-common does not need to be named.
dune_module_dependencies = {
'dune-alugrid': ['dune-grid'],
'dune-codegen': ['dune-pdelab', 'dune-testtools', 'dune-alugrid'],
'dune-fem': ['dune-grid'],
'dune-fempy': ['dune-fem'],
'dune-foamgrid': ['dune-grid'],
'dune-functions': ["dune-grid", "dune-typetree", "dune-localfunctions", "dune-istl"],
'dune-grid': ['dune-geometry'],
'dune-grid-glue': ['dune-grid'],
'dune-localfunctions': ['dune-geometry'],
'dune-multidomaingrid': ['dune-grid', 'dune-typetree'],
'dune-pdelab': ['dune-istl', 'dune-functions'],
'dune-polygongrid': ['dune-grid'],
}
# Build the closure of above module dependency list.
# We need to use cryptic variable names here because
# Spack behaves in weird ways if we accidentally use
# names (like 'module') that are used in seemingly
# unrelated places.
for _mod in dune_module_dependencies:
_closure = set(dune_module_dependencies[_mod])
_old_closure = set()
while (len(_closure) > len(_old_closure)):
_old_closure = _closure.copy()
for _res in _old_closure:
for _m in dune_module_dependencies.get(_res, []):
_closure.add(_m)
dune_module_dependencies[_mod] = list(_closure)
# Variants for the general build process
variant('shared', default=True, description='Enables the build of shared libraries.')
@ -45,154 +107,225 @@ class Dune(CMakePackage):
variant('doc', default=False, description='Build and install documentation')
variant('python', default=False, description='Build with Python bindings')
# Variants for upstream dependencies
variant('arpack', default=True, description='Build ARnoldi PACKage library support')
variant('blas', default=True, description='Build with BLAS support')
variant('gmp', default=True, description='Build with GNU multi-precision library support')
variant('lapack', default=True, description='Build with LAPACK support')
variant('metis', default=True, description='Build with METIS library support')
# Variants for upstream dependencies. Note that we are exposing only very
# costly upstream dependencies as variants. All other upstream dependencies
# are installed unconditionally. This happens in an attempt to limit the total
# number of variants of the dune package to a readable amount. An exception
# to this rule is ParMETIS, which has a variant because of it's semi-free license.
variant('parmetis', default=False, description='Build with ParMETIS support')
variant('ptscotch', default=True, description='Build with PT-Scotch support')
variant('sionlib', default=False, description='Build with SIONlib support')
variant('suitesparse', default=True, description='Build SuiteSparse library support')
variant('superlu', default=False, description='Build Supernodal LU library support')
variant('petsc', default=False, description='Build with PetSc support')
variant('tbb', default=False, description='Build with Intel TBB support')
variant('vc', default=False, description='Build C++ Vectorization library support')
variant('zlib', default=False, description='Build zlib library support')
variant('zoltan', default=False, description='Build with Zoltan support')
# Some variants that were here that are on my todo list
# variant('jupyter', default=False, description='Build with Jupyter support')
# Define one variant for each non-core Dune module that we have.
for var, res in dune_variants_to_resources.items():
variant(var, default=False, description='Build with the %s module' % res)
# Define one variant for each Dune module that we have. Only core modules
# are activated by default.
variant('alugrid', default=False, description='Build with dune-alugrid module')
variant('functions', default=False, description='Build with dune-functions module')
variant('geometry', default=True, description='Build with dune-geometry module')
variant('grid', default=True, description='Build with dune-grid module')
variant('istl', default=True, description='Build with dune-istl module')
variant('localfunctions', default=True, description='Build with dune-localfunctions module')
variant('spgrid', default=False, description='Build with dune-spgrid module')
variant('typetree', default=False, description='Build with dune-typetree module')
variant('uggrid', default=False, description='Build with dune-uggrid module')
# Define conflicts between Dune module variants. These conflicts are of the following type:
# conflicts('dune~functions', when='+pdelab') -> dune-pdelab cannot be built without dune-functions
for var, res in dune_variants_to_resources.items():
for dep in dune_module_dependencies.get(res, []):
if dep in dune_resources_to_variants:
conflicts('dune~%s' % dune_resources_to_variants[dep], when='+%s' % var)
# Iterate over all available Dune versions and define resources for all Dune modules
# If a Dune module behaves differently for different versions (e.g. dune-python got
# merged into dune-common post-2.7), define the resource outside of this loop.
for vers, branch in dune_versions_to_branch.items():
version(vers, branch=dune_versions_to_branch[vers])
for _vers, _branch in dune_versions_to_branch:
version(_vers, branch=_branch)
resource(
name='dune-geometry',
git='https://gitlab.dune-project.org/core/dune-geometry.git',
branch=branch,
when='@%s+geometry' % vers,
branch=_branch,
when='@%s' % _vers,
)
resource(
name='dune-grid',
git='https://gitlab.dune-project.org/core/dune-grid.git',
branch=branch,
when='@%s+grid' % vers,
branch=_branch,
when='@%s' % _vers,
)
resource(
name='dune-istl',
git='https://gitlab.dune-project.org/core/dune-istl.git',
branch=branch,
when='@%s+istl' % vers,
branch=_branch,
when='@%s' % _vers,
)
resource(
name='dune-localfunctions',
git='https://gitlab.dune-project.org/core/dune-localfunctions.git',
branch=branch,
when='@%s+localfunctions' % vers,
branch=_branch,
when='@%s' % _vers,
)
resource(
name='dune-functions',
git='https://gitlab.dune-project.org/staging/dune-functions.git',
branch=branch,
when='@%s+functions' % vers,
branch=_branch,
when='@%s+functions' % _vers,
)
resource(
name='dune-typetree',
git='https://gitlab.dune-project.org/staging/dune-typetree.git',
branch=branch,
when='@%s+typetree' % vers,
branch=_branch,
when='@%s+typetree' % _vers,
)
resource(
name='dune-alugrid',
git='https://gitlab.dune-project.org/extensions/dune-alugrid.git',
branch=branch,
when='@%s+alugrid' % vers,
branch=_branch,
when='@%s+alugrid' % _vers,
)
resource(
name='dune-uggrid',
git='https://gitlab.dune-project.org/staging/dune-uggrid.git',
branch='releases/2.7',
when='@%s+uggrid' % vers,
branch=_branch,
when='@%s+uggrid' % _vers,
)
resource(
name='dune-spgrid',
git='https://gitlab.dune-project.org/extensions/dune-spgrid.git',
branch=branch,
when='@%s+spgrid' % vers,
branch=_branch,
when='@%s+spgrid' % _vers,
)
resource(
name='dune-testtools',
git='https://gitlab.dune-project.org/quality/dune-testtools.git',
branch=_branch,
when='@%s+testtools' % _vers,
)
resource(
name='dune-polygongrid',
git='https://gitlab.dune-project.org/extensions/dune-polygongrid.git',
branch=_branch,
when='@%s+polygongrid' % _vers,
)
resource(
name='dune-foamgrid',
git='https://gitlab.dune-project.org/extensions/dune-foamgrid.git',
branch=_branch,
when='@%s+foamgrid' % _vers,
)
resource(
name='dune-multidomaingrid',
git='https://gitlab.dune-project.org/extensions/dune-multidomaingrid.git',
branch=_branch,
when='@%s+multidomaingrid' % _vers,
)
resource(
name='dune-fem',
git='https://gitlab.dune-project.org/dune-fem/dune-fem.git',
branch=_branch,
when='@%s+fem' % _vers,
)
resource(
name='dune-fempy',
git='https://gitlab.dune-project.org/dune-fem/dune-fempy.git',
branch=_branch,
when='@%s+fem+python' % _vers,
)
resource(
name='dune-pdelab',
git='https://gitlab.dune-project.org/pdelab/dune-pdelab.git',
branch=_branch,
when='@%s+pdelab' % _vers,
)
# The dune-grid-glue package does not yet have a 2.7-compatible release
resource(
name='dune-grid-glue',
git='https://gitlab.dune-project.org/extensions/dune-grid-glue.git',
branch=_branch,
when='@%s+gridglue' % _vers,
)
# The dune-python package migrated to dune-common after the 2.7 release
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch='releases/2.7',
when='@2.7+python',
)
resource(
name='dune-python',
git='https://gitlab.dune-project.org/staging/dune-python.git',
branch=branch,
when='@2.7+python',
branch='releases/2.6',
when='@2.6+python',
)
# Dependencies between modules
module_dependencies={"dune-common":[]}
module_dependencies["dune-geometry"]=["dune-common"]
module_dependencies["dune-grid"]=["dune-common","dune-geometry"]
module_dependencies["dune-uggrid"]=["dune-common"]
module_dependencies["dune-istl"]=["dune-common"]
module_dependencies["dune-localfunctions"]=["dune-common","dune-geometry"]
module_dependencies["dune-functions"]=["dune-grid","dune-typetree","dune-localfunctions","dune-istl"]
module_dependencies["dune-typetree"]=["dune-common"]
module_dependencies["dune-python"]=[]
module_dependencies["dune-alugrid"]=["dune-grid","dune-geometry","dune-common"]
# The dune-codegen package does not have a 2.6-compatible release
resource(
name='dune-codegen',
git='https://gitlab.dune-project.org/extensions/dune-codegen.git',
branch='master',
when='@master+codegen',
submodules=True,
)
resource(
name='dune-codegen',
git='https://gitlab.dune-project.org/extensions/dune-codegen.git',
branch='releases/2.7',
when='@2.7+codegen',
submodules=True,
)
conflicts('dune@2.6', when='+codegen')
# Make sure that Python components integrate well into Spack
extends('python')
python_components = [ 'dune' ]
# Specify upstream dependencies (often depending on variants)
depends_on('arpack-ng', when='+arpack')
depends_on('blas', when='+blas')
depends_on('amgx', when='+fem+petsc')
depends_on('arpack-ng')
depends_on('benchmark', when='+codegen')
depends_on('blas')
depends_on('cmake@3.1:', type='build')
depends_on('eigen', when='+fem')
depends_on('eigen', when='+pdelab')
depends_on('papi', when='+fem')
depends_on('doxygen', type='build', when='+doc')
depends_on('gawk')
depends_on('gmp', when='+gmp')
depends_on('gmp')
depends_on('intel-tbb', when='+tbb')
depends_on('lapack', when='+lapack')
depends_on('metis', when='+metis')
depends_on('lapack')
# depends_on('likwid', when='+codegen') likwid cannot be built in spack v0.14.2 due to the lua dependency being broken
depends_on('mpi')
depends_on('parmetis', when='+parmetis')
depends_on('petsc', when='+petsc')
depends_on('pkg-config', type='build')
depends_on('python@3.0:', type=('build', 'run'), when='+python')
depends_on('python@3.0:', type=('build', 'run'))
depends_on('py-setuptools', type='build', when='+python')
depends_on('py-numpy', type=('build', 'run'), when='+python')
depends_on('py-pip', type=('build', 'run'), when='+python')
depends_on('py-pip', type=('build', 'run'))
depends_on('py-sphinx', type=('build', 'run'), when='+doc')
depends_on('py-wheel', type='build', when='+python')
depends_on('scotch+mpi', when='+ptscotch')
depends_on('sionlib', when='+sionlib')
depends_on('suite-sparse', when='+suitesparse')
depends_on('superlu', when='+superlu')
depends_on('vc', when='+vc')
depends_on('zlib', when='+zlib')
depends_on('zoltan', when='+zoltan')
depends_on('py-wheel', type='build')
depends_on('scotch+mpi')
depends_on('suite-sparse')
depends_on('superlu')
depends_on('vc')
depends_on('zlib', when='+alugrid')
depends_on('zoltan', when='+alugrid')
# Apply patches
patch('virtualenv_from_envvariable.patch', when='+testtools')
patch('pdelab_2.6_update_cmake.patch', when='@2.6+pdelab', working_dir= 'dune-pdelab')
def setup_build_environment(self, env):
# We reset the DUNE_CONTROL_PATH here because any entries in this
@ -208,7 +341,12 @@ class Dune(CMakePackage):
# Additionally, we need to set the workspace for the Python bindings to something
# that is unique to this build of the dune module (it defaults to ~/.cache)
if '+python' in self.spec:
env.set('DUNE_PY_DIR', self.prefix)
env.set('DUNE_PY_DIR', join_path(Path.home(), '.cache', 'dune-py', self.spec.dag_hash()))
# For those modules that typically work with the Dune Virtualenv,
# we export the location of the virtualenv as an environment variable.
if '+testtools' in self.spec:
env.set('DUNE_PYTHON_VIRTUALENV_PATH', join_path(Path.home(), '.cache', 'dune-python-env', self.spec.dag_hash()))
def cmake_args(self):
"""Populate cmake arguments."""
@ -224,25 +362,21 @@ class Dune(CMakePackage):
return variant_bool(feature, on='OFF', off='ON')
cmake_args = [
'-DCMAKE_BUILD_TYPE:STRING=%s' % self.spec.variants['build_type'].value,
'-DBUILD_SHARED_LIBS:BOOL=%s' % variant_bool('+shared'),
'-DDUNE_GRID_GRIDTYPE_SELECTOR:BOOL=ON',
'-DCMAKE_DISABLE_FIND_PACKAGE_BLAS=%s' % nvariant_bool('+blas'),
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_GMP=%s' % nvariant_bool('+gmp'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LAPACK=%s' % nvariant_bool('+lapack'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_METIS=%s' % nvariant_bool('+metis'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS=%s' % nvariant_bool('+parmetis'),
'-DCMAKE_DISABLE_FIND_PACKAGE_PTScotch=%s' % nvariant_bool('+ptscotch'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SIONLib=%s' % nvariant_bool('+sionlib'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SuiteSparse=%s' % nvariant_bool('+suitesparse'),
'-DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=%s' % nvariant_bool('+superlu'),
'-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen:BOOL=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX:BOOL=%s' % nvariant_bool('+doc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ParMETIS:BOOL=%s' % nvariant_bool('+parmetis'),
# '-DCMAKE_DISABLE_FIND_PACKAGE_TBB=%s' % nvariant_bool('+tbb'), Disabled until upstream fix of dune-common#205.
'-DCMAKE_DISABLE_FIND_PACKAGE_VC=%s' % nvariant_bool('+vc'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=%s' % nvariant_bool('+zlib'),
'-DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=%s' % nvariant_bool('+zoltan'),
]
if '+testtools' in spec:
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_SETUP:BOOL=ON')
cmake_args.append('-DDUNE_PYTHON_ALLOW_GET_PIP:BOOL=ON')
cmake_args.append('-DDUNE_PYTHON_VIRTUALENV_PATH:STRING="%s"' % join_path(Path.home(), '.cache', 'dune-python-env', self.spec.dag_hash()))
cmake_args.append('-DDUNE_PYTHON_INSTALL_LOCATION:STRING="system"')
if '+python' in spec:
if '@2.7' not in spec:
cmake_args.append('-DDUNE_ENABLE_PYTHONBINDINGS:BOOL=TRUE')
@ -251,35 +385,13 @@ class Dune(CMakePackage):
return cmake_args
def module_dependency_closure(self, when, reslist):
# Get a list of all modules that share the version requirement
all_resources = []
for w, rl in self.resources.items():
if w.version == when.version:
all_resources.extend(rl)
# And build the closure of modules from the given reslist
closure = set(reslist)
old_closure = set()
while (len(closure) > len(old_closure)):
old_closure = closure.copy()
for res in old_closure:
for mod in self.module_dependencies.get(res.name, []):
for r in all_resources:
if r.name == mod:
closure.add(r)
return list(closure)
def _get_needed_resources(self):
# Modify the list of resources by building a transitive closure of Dune module dependencies.
self.resources = {when: self.module_dependency_closure(when, reslist) for when, reslist in self.resources.items()}
# and call the original implementation
return CMakePackage._get_needed_resources(self)
def cmake(self, spec, prefix):
# dune-codegen delivers its own set of patches for its submodules
# that we can apply with a script delivered by dune-codegen.
if '+codegen' in self.spec:
with working_dir(join_path(self.root_cmakelists_dir, 'dune-codegen')):
Executable('patches/apply_patches.sh')()
# Write an opts file for later use
with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile:
optFile.write('CMAKE_FLAGS="')
@ -290,7 +402,13 @@ class Dune(CMakePackage):
installer = Executable('bin/dunecontrol')
options_file = join_path(self.stage.source_path, "..", "dune.opts")
installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, 'cmake')
# The 'cmake' command of dunecontrol was added in 2.7
commandname = 'cmake'
if '@2.6' in self.spec:
commandname = 'configure'
installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, commandname)
def install(self, spec, prefix):
installer = Executable('bin/dunecontrol')

View File

@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc069408..3971e6aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
project("dune-pdelab" C CXX)
# general stuff
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.6)
# guess dune-common build dir
if(NOT (dune-common_DIR OR dune-common_ROOT OR
@@ -25,26 +25,18 @@ dune_project()
# Disable the upstream testing magic, that builds tests during "make test"
set(DUNE_TEST_MAGIC OFF)
-# To have enable all packages work with cmake-2.8, the module
-# libraries need to be added before the call to dune_enable_all_packages()
-# With cmake 3.1, one would use the MODULE_LIBRARIES argument of
-# dune_enable_all_packages() instead.
+# Use the enable all packages feature
+dune_enable_all_packages(MODULE_LIBRARIES dunepdelab)
if(NOT MINGW)
set(clock_cc "dune/pdelab/common/clock.cc")
endif()
-dune_add_library(dunepdelab
+dune_library_add_sources(dunepdelab SOURCES
${clock_cc}
dune/pdelab/common/hostname.cc
dune/pdelab/common/logtag.cc
- )
-dune_target_enable_all_packages(dunepdelab)
-
-dune_register_package_flags(LIBRARIES dunepdelab)
-
-# Use the enable all packages feature
-dune_enable_all_packages()
+)
add_subdirectory(doc)
add_subdirectory(dune/pdelab)

View File

@ -0,0 +1,30 @@
diff --git a/cmake/modules/DunePythonCommonMacros.cmake b/cmake/modules/DunePythonCommonMacros.cmake
index 6f8ff307..93ea3e9c 100644
--- a/cmake/modules/DunePythonCommonMacros.cmake
+++ b/cmake/modules/DunePythonCommonMacros.cmake
@@ -149,6 +149,10 @@ function(dune_python_require_virtualenv_setup)
endif()
endfunction()
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
+ set(DUNE_PYTHON_VIRTUALENV_SETUP 1)
+endif()
+
# If requested, switch into DunePythonVirtualenv.cmake and setup the virtualenv.
if(DUNE_PYTHON_VIRTUALENV_SETUP)
include(DunePythonVirtualenv)
diff --git a/cmake/modules/DunePythonVirtualenv.cmake b/cmake/modules/DunePythonVirtualenv.cmake
index 8a09676f..96cb5954 100644
--- a/cmake/modules/DunePythonVirtualenv.cmake
+++ b/cmake/modules/DunePythonVirtualenv.cmake
@@ -81,6 +81,10 @@ set(DUNE_PYTHON_EXTERNAL_VIRTUALENV_FOR_ABSOLUTE_BUILDDIR ON CACHE BOOL
"Place Python virtualenv in top-level directory \"dune-python-env\" when using an absolute build directory"
)
+if (NOT "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}" STREQUAL "")
+ set(DUNE_PYTHON_VIRTUALENV_PATH "$ENV{DUNE_PYTHON_VIRTUALENV_PATH}")
+endif()
+
if(DUNE_PYTHON_VIRTUALENV_PATH STREQUAL "")
foreach(mod ${ALL_DEPENDENCIES})
if(IS_DIRECTORY ${${mod}_DIR}/dune-env)