Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1030f7e
better testing of (outdated) standard_integrators
pancetta Jan 10, 2023
1f6470c
Better tests of asympconf_Linf
pancetta Jan 10, 2023
798c925
black...
pancetta Jan 10, 2023
4ab008c
Ran spell checker on tutorials
Jan 11, 2023
ee6bbde
Ran spellchecker on all core modules
Jan 11, 2023
a1b8a60
Merge pull request #241 from brownbaerchen/spell_checking
pancetta Jan 11, 2023
afa3483
Update README.rst
pancetta Jan 12, 2023
1b0d898
Merge branch 'master' of https://github.com/Parallel-in-Time/pySDC
pancetta Jan 12, 2023
c74a9fe
Allowing multiple hook classes now
Jan 12, 2023
6191177
Error estimating convergence controllers will now add hooks to record
Jan 12, 2023
2be53b8
Adhering to python standards for naming classes
Jan 12, 2023
7c33bd0
Forgot to add some files to the commit
Jan 12, 2023
0de2f8d
Added a step size hook
Jan 12, 2023
02dc5d4
Adapted controller in project
Jan 12, 2023
226d9dd
Dealt with dangerous business of restarts a little bit
Jan 13, 2023
f14c47d
Changed CI pipeline so use secrets from target repository upon PR
Jan 13, 2023
f6b465e
Added types for `on: pull_request_target`
Jan 13, 2023
4a8a5b6
Reverted previous commit because it didn't help
Jan 13, 2023
81d5944
Update ci_pipeline.yml
pancetta Jan 15, 2023
a83fa6b
Update ci_pipeline.yml
pancetta Jan 16, 2023
41a1113
Update pyproject.toml
pancetta Jan 16, 2023
5159368
Update README.rst
pancetta Jan 16, 2023
1de8d2f
Update README.rst
pancetta Jan 16, 2023
23976b6
Removing any changes to the CI pipeline from this PR
Jan 16, 2023
66cc5bc
Merge remote-tracking branch 'upstream/master' into controller_restru…
Jan 16, 2023
92a9a1e
Merge pull request #246 from brownbaerchen/controller_restructure
pancetta Jan 16, 2023
e24debc
Update README.rst
pancetta Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 41 additions & 38 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ jobs:
run: |
flakeheaven lint --benchmark pySDC

mirror_to_gitlab:
# mirror_to_gitlab:

runs-on: ubuntu-latest
# runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1
# steps:
# - name: Checkout
# uses: actions/checkout@v1

- name: Mirror
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
GITLAB_PROJECT_ID: "3525"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Mirror
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

user_cpu_tests_linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -121,31 +121,31 @@ jobs:
pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}


wait_for_gitlab:
runs-on: ubuntu-latest
# wait_for_gitlab:
# runs-on: ubuntu-latest

needs:
- mirror_to_gitlab
# needs:
# - mirror_to_gitlab

steps:
- name: Wait
uses: jakob-fritz/github2lab_action@main
env:
MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
GITLAB_PROJECT_ID: "3525"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# steps:
# - name: Wait
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Get and prepare artifacts
# run: |
# pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# rm -rf data
# unzip artifacts.zip
# ls -ratl
# # - name: Get and prepare artifacts
# # run: |
# # pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# # job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# # curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# # rm -rf data
# # unzip artifacts.zip
# # ls -ratl


post-processing:
Expand All @@ -156,7 +156,7 @@ jobs:
needs:
- lint
- user_cpu_tests_linux
- wait_for_gitlab
# - wait_for_gitlab

defaults:
run:
Expand Down Expand Up @@ -188,7 +188,10 @@ jobs:
run: |
pip install genbadge[all]
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg


- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

# - name: Generate benchmark report
# uses: pancetta/github-action-benchmark@v1
# if: ${{ (!contains(github.event.head_commit.message, '[CI-no-benchmarks]')) && (github.event_name == 'push') }}
Expand Down
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
|badge-ga|
|badge-ossf|
|badge-cc|
|zenodo|

Welcome to pySDC!
=================

Expand Down Expand Up @@ -74,3 +79,11 @@ This project has received funding from the `European High-Performance Computing
The JU receives support from the European Union’s Horizon 2020 research and innovation programme and Belgium, France, Germany, and Switzerland.
This project also received funding from the `German Federal Ministry of Education and Research <https://www.bmbf.de/bmbf/en/home/home_node.html>`_ (BMBF) grant 16HPC047.
The project also received help from the `Helmholtz Platform for Research Software Engineering - Preparatory Study (HiRSE_PS) <https://www.helmholtz-hirse.de/>`_.


.. |badge-ga| image:: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml/badge.svg?branch=master
:target: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml
.. |badge-ossf| image:: https://bestpractices.coreinfrastructure.org/projects/6909/badge
:target: https://bestpractices.coreinfrastructure.org/projects/6909
.. |badge-cc| image:: https://codecov.io/gh/Parallel-in-Time/pySDC/branch/master/graph/badge.svg?token=hpP18dmtgS
:target: https://codecov.io/gh/Parallel-in-Time/pySDC
2 changes: 1 addition & 1 deletion pySDC/core/BaseTransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def restrict(self):
"""
Space-time restriction routine

The routine applies the spatial restriction operator to teh fine values on the fine nodes, then reevaluates f
The routine applies the spatial restriction operator to the fine values on the fine nodes, then reevaluates f
on the coarse level. This is used for the first part of the FAS correction tau via integration. The second part
is the integral over the fine values, restricted to the coarse level. Finally, possible tau corrections on the
fine level are restricted as well.
Expand Down
2 changes: 1 addition & 1 deletion pySDC/core/Collocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad
self.node_type = node_type
self.quad_type = quad_type

# Instanciate attributes
# Instantiate attributes
self.nodeGenerator = NodesGenerator(self.node_type, self.quad_type)
if self.node_type == 'EQUID':
self.order = num_nodes
Expand Down
43 changes: 37 additions & 6 deletions pySDC/core/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import sys
import numpy as np

from pySDC.core import Hooks as hookclass
from pySDC.core.BaseTransfer import base_transfer
from pySDC.helpers.pysdc_helper import FrozenClass
from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence
from pySDC.implementations.hooks.default_hook import DefaultHooks


# short helper class to add params as attributes
Expand Down Expand Up @@ -40,11 +40,16 @@ def __init__(self, controller_params, description):
controller_params (dict): parameter set for the controller and the steps
"""

# check if we have a hook on this list. if not, use default class.
controller_params['hook_class'] = controller_params.get('hook_class', hookclass.hooks)
self.__hooks = controller_params['hook_class']()
# check if we have a hook on this list. If not, use default class.
self.__hooks = []
hook_classes = [DefaultHooks]
user_hooks = controller_params.get('hook_class', [])
hook_classes += user_hooks if type(user_hooks) == list else [user_hooks]
[self.add_hook(hook) for hook in hook_classes]
controller_params['hook_class'] = controller_params.get('hook_class', hook_classes)

self.hooks.pre_setup(step=None, level_number=None)
for hook in self.hooks:
hook.pre_setup(step=None, level_number=None)

self.params = _Pars(controller_params)

Expand Down Expand Up @@ -101,6 +106,20 @@ def __setup_custom_logger(level=None, log_to_file=None, fname=None):
else:
pass

def add_hook(self, hook):
"""
Add a hook to the controller which will be called in addition to all other hooks whenever something happens.
The hook is only added if a hook of the same class is not already present.

Args:
hook (pySDC.Hook): A hook class that is derived from the core hook class

Returns:
None
"""
if hook not in [type(me) for me in self.hooks]:
self.__hooks += [hook()]

def welcome_message(self):
out = (
"Welcome to the one and only, really very astonishing and 87.3% bug free"
Expand Down Expand Up @@ -262,7 +281,7 @@ def add_convergence_controller(self, convergence_controller, description, params
Args:
convergence_controller (pySDC.ConvergenceController): The convergence controller to be added
description (dict): The description object used to instantiate the controller
params (dict): Parametes for the convergence controller
params (dict): Parameters for the convergence controller
allow_double (bool): Allow adding the same convergence controller multiple times

Returns:
Expand Down Expand Up @@ -308,3 +327,15 @@ def get_convergence_controllers_as_table(self, description):
out += f'\n{user_added}|{i:3} | {C.params.control_order:5} | {type(C).__name__}'

return out

def return_stats(self):
"""
Return the merged stats from all hooks

Returns:
dict: Merged stats from all hooks
"""
stats = {}
for hook in self.hooks:
stats = {**stats, **hook.return_stats()}
return stats
Loading