Skip to content

Commit 935b4bb

Browse files
committed
Solved merge conflict
2 parents a055c4d + e24debc commit 935b4bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+815
-490
lines changed

.github/workflows/ci_pipeline.yml

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ jobs:
3535
run: |
3636
flakeheaven lint --benchmark pySDC
3737
38-
mirror_to_gitlab:
38+
# mirror_to_gitlab:
3939

40-
runs-on: ubuntu-latest
40+
# runs-on: ubuntu-latest
4141

42-
steps:
43-
- name: Checkout
44-
uses: actions/checkout@v1
42+
# steps:
43+
# - name: Checkout
44+
# uses: actions/checkout@v1
4545

46-
- name: Mirror
47-
uses: jakob-fritz/github2lab_action@main
48-
env:
49-
MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
50-
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
51-
FORCE_PUSH: "true"
52-
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
53-
GITLAB_PROJECT_ID: "3525"
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
# - name: Mirror
47+
# uses: jakob-fritz/github2lab_action@main
48+
# env:
49+
# MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
50+
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
51+
# FORCE_PUSH: "true"
52+
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
53+
# GITLAB_PROJECT_ID: "3525"
54+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5555

5656
user_cpu_tests_linux:
5757
runs-on: ubuntu-latest
@@ -121,31 +121,31 @@ jobs:
121121
pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}
122122
123123
124-
wait_for_gitlab:
125-
runs-on: ubuntu-latest
124+
# wait_for_gitlab:
125+
# runs-on: ubuntu-latest
126126

127-
needs:
128-
- mirror_to_gitlab
127+
# needs:
128+
# - mirror_to_gitlab
129129

130-
steps:
131-
- name: Wait
132-
uses: jakob-fritz/github2lab_action@main
133-
env:
134-
MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
135-
GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
136-
FORCE_PUSH: "true"
137-
GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
138-
GITLAB_PROJECT_ID: "3525"
139-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
# steps:
131+
# - name: Wait
132+
# uses: jakob-fritz/github2lab_action@main
133+
# env:
134+
# MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
135+
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
136+
# FORCE_PUSH: "true"
137+
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
138+
# GITLAB_PROJECT_ID: "3525"
139+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140140

141-
# - name: Get and prepare artifacts
142-
# run: |
143-
# 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')
144-
# 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')
145-
# curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
146-
# rm -rf data
147-
# unzip artifacts.zip
148-
# ls -ratl
141+
# # - name: Get and prepare artifacts
142+
# # run: |
143+
# # 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')
144+
# # 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')
145+
# # curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
146+
# # rm -rf data
147+
# # unzip artifacts.zip
148+
# # ls -ratl
149149

150150

151151
post-processing:
@@ -156,7 +156,7 @@ jobs:
156156
needs:
157157
- lint
158158
- user_cpu_tests_linux
159-
- wait_for_gitlab
159+
# - wait_for_gitlab
160160

161161
defaults:
162162
run:
@@ -188,7 +188,10 @@ jobs:
188188
run: |
189189
pip install genbadge[all]
190190
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg
191-
191+
192+
- name: Upload coverage reports to Codecov
193+
uses: codecov/codecov-action@v3
194+
192195
# - name: Generate benchmark report
193196
# uses: pancetta/github-action-benchmark@v1
194197
# if: ${{ (!contains(github.event.head_commit.message, '[CI-no-benchmarks]')) && (github.event_name == 'push') }}

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
|badge-ga|
2+
|badge-ossf|
3+
|badge-cc|
4+
|zenodo|
5+
16
Welcome to pySDC!
27
=================
38

@@ -74,3 +79,11 @@ This project has received funding from the `European High-Performance Computing
7479
The JU receives support from the European Union’s Horizon 2020 research and innovation programme and Belgium, France, Germany, and Switzerland.
7580
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.
7681
The project also received help from the `Helmholtz Platform for Research Software Engineering - Preparatory Study (HiRSE_PS) <https://www.helmholtz-hirse.de/>`_.
82+
83+
84+
.. |badge-ga| image:: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml/badge.svg?branch=master
85+
:target: https://github.com/Parallel-in-Time/pySDC/actions/workflows/ci_pipeline.yml
86+
.. |badge-ossf| image:: https://bestpractices.coreinfrastructure.org/projects/6909/badge
87+
:target: https://bestpractices.coreinfrastructure.org/projects/6909
88+
.. |badge-cc| image:: https://codecov.io/gh/Parallel-in-Time/pySDC/branch/master/graph/badge.svg?token=hpP18dmtgS
89+
:target: https://codecov.io/gh/Parallel-in-Time/pySDC

pySDC/core/BaseTransfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def restrict(self):
8383
"""
8484
Space-time restriction routine
8585
86-
The routine applies the spatial restriction operator to teh fine values on the fine nodes, then reevaluates f
86+
The routine applies the spatial restriction operator to the fine values on the fine nodes, then reevaluates f
8787
on the coarse level. This is used for the first part of the FAS correction tau via integration. The second part
8888
is the integral over the fine values, restricted to the coarse level. Finally, possible tau corrections on the
8989
fine level are restricted as well.

pySDC/core/Collocation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, num_nodes=None, tleft=0, tright=1, node_type='LEGENDRE', quad
9090
self.node_type = node_type
9191
self.quad_type = quad_type
9292

93-
# Instanciate attributes
93+
# Instantiate attributes
9494
self.nodeGenerator = NodesGenerator(self.node_type, self.quad_type)
9595
if self.node_type == 'EQUID':
9696
self.order = num_nodes

pySDC/core/Controller.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import sys
44
import numpy as np
55

6-
from pySDC.core import Hooks as hookclass
76
from pySDC.core.BaseTransfer import base_transfer
87
from pySDC.helpers.pysdc_helper import FrozenClass
98
from pySDC.implementations.convergence_controller_classes.check_convergence import CheckConvergence
9+
from pySDC.implementations.hooks.default_hook import DefaultHooks
1010

1111

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

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

47-
self.hooks.pre_setup(step=None, level_number=None)
51+
for hook in self.hooks:
52+
hook.pre_setup(step=None, level_number=None)
4853

4954
self.params = _Pars(controller_params)
5055

@@ -101,6 +106,20 @@ def __setup_custom_logger(level=None, log_to_file=None, fname=None):
101106
else:
102107
pass
103108

109+
def add_hook(self, hook):
110+
"""
111+
Add a hook to the controller which will be called in addition to all other hooks whenever something happens.
112+
The hook is only added if a hook of the same class is not already present.
113+
114+
Args:
115+
hook (pySDC.Hook): A hook class that is derived from the core hook class
116+
117+
Returns:
118+
None
119+
"""
120+
if hook not in [type(me) for me in self.hooks]:
121+
self.__hooks += [hook()]
122+
104123
def welcome_message(self):
105124
out = (
106125
"Welcome to the one and only, really very astonishing and 87.3% bug free"
@@ -262,7 +281,7 @@ def add_convergence_controller(self, convergence_controller, description, params
262281
Args:
263282
convergence_controller (pySDC.ConvergenceController): The convergence controller to be added
264283
description (dict): The description object used to instantiate the controller
265-
params (dict): Parametes for the convergence controller
284+
params (dict): Parameters for the convergence controller
266285
allow_double (bool): Allow adding the same convergence controller multiple times
267286
268287
Returns:
@@ -308,3 +327,15 @@ def get_convergence_controllers_as_table(self, description):
308327
out += f'\n{user_added}|{i:3} | {C.params.control_order:5} | {type(C).__name__}'
309328

310329
return out
330+
331+
def return_stats(self):
332+
"""
333+
Return the merged stats from all hooks
334+
335+
Returns:
336+
dict: Merged stats from all hooks
337+
"""
338+
stats = {}
339+
for hook in self.hooks:
340+
stats = {**stats, **hook.return_stats()}
341+
return stats

0 commit comments

Comments
 (0)