Skip to content

Commit 7cd6708

Browse files
committed
Merge branch 'petsc'
# Conflicts: # .travis.yml # docs/source/index.rst
2 parents 9d4fda2 + 1523f0d commit 7cd6708

Some content is hidden

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

55 files changed

+4813
-116
lines changed

.travis.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: required
1+
sudo: false
22
dist: trusty
33

44
language: python
@@ -16,15 +16,19 @@ before_install:
1616
- conda update --yes conda
1717

1818
install:
19-
- conda install --yes python=${TRAVIS_PYTHON_VERSION} numpy future scipy matplotlib nose pep8 coverage mpi4py sympy dill numba
20-
- conda install --yes python=${TRAVIS_PYTHON_VERSION} sphinx=1.6.3
21-
- pip install --user coloredlogs
22-
- if [[ $PYTHON_VERSION == 3 ]]; then pip install --user travis-sphinx; fi
19+
- conda install --yes -c conda-forge petsc4py mpi4py
20+
- conda install --yes python=${TRAVIS_PYTHON_VERSION} pip numpy future scipy matplotlib nose pep8 coverage sympy dill numba sphinx
21+
- conda list
22+
- pip install coloredlogs
23+
- pip install travis-sphinx
2324
- sudo apt-get install -y texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra dvipng
2425

2526
script:
2627
- "./docs/update_apidocs.sh"
27-
- nosetests --with-coverage --cover-erase --cover-inclusive --cover-package=pySDC/core,pySDC/implementations,pySDC/helpers,pySDC/tutorial --cover-html --cover-html-dir=doc/build/test_coverage pySDC/tests
28+
- which nosetests
29+
# - export MPICH_NO_LOCAL=1
30+
- export PYTHONPATH=$PYTHONPATH:../../..
31+
- nosetests -v --with-coverage --cover-erase --cover-inclusive --cover-package=pySDC/core,pySDC/implementations,pySDC/helpers,pySDC/tutorial,pySDC/projects --cover-html --cover-html-dir=doc/build/test_coverage pySDC/tests
2832
- if [[ $PYTHON_VERSION == 3 ]]; then travis-sphinx build; fi
2933

3034
after_success:
@@ -39,4 +43,14 @@ deploy:
3943
secure: id5Pg/GL/YdXFmbi5h4xLmmyv/0L8lj9Rlr7lFJBrHrmkHIlu78NgO+LnQsGvhSrZqdDvZwRzFFCKRLiDugp07rzfwM41ROPrcgwnSRuqnzG2sUecNulNGHHoqej/z8nG5Ss8k2+viMqpOjhhZoY3LR0D1nFxRzu3HtHs0MKpRc=
4044
on:
4145
tags: true
46+
condition: $TRAVIS_PYTHON_VERSION = "2.7"
47+
- provider: pypi
48+
edge:
49+
branch: jc-pypi
50+
user: pancetta
51+
password:
52+
secure: id5Pg/GL/YdXFmbi5h4xLmmyv/0L8lj9Rlr7lFJBrHrmkHIlu78NgO+LnQsGvhSrZqdDvZwRzFFCKRLiDugp07rzfwM41ROPrcgwnSRuqnzG2sUecNulNGHHoqej/z8nG5Ss8k2+viMqpOjhhZoY3LR0D1nFxRzu3HtHs0MKpRc=
53+
server: https://test.pypi.org/legacy/
54+
on:
55+
tags: false
4256
condition: $TRAVIS_PYTHON_VERSION = "2.7"

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Projects
9696
projects/asymp_conv.rst
9797
projects/matrixPFASST.rst
9898
projects/Hamiltonian.rst
99+
projects/SDC_showdown.rst
99100

100101

101102
Tests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: /../../pySDC/projects/SDC_showdown/README.rst
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Full code: `pySDC/projects/SDC_showdown/SDC_timing_Fisher.py <https://github.com/Parallel-in-Time/pySDC/blob/master/pySDC/projects/SDC_showdown/SDC_timing_Fisher.py>`_
2+
3+
.. literalinclude:: ../../../pySDC/projects/SDC_showdown/SDC_timing_Fisher.py
4+
5+
Results:
6+
7+
.. image:: ../../../data/timings_SDC_variants_Fisher.png
8+
:scale: 100 %
9+
10+
11+
Full code: `pySDC/projects/SDC_showdown/SDC_timing_GrayScott.py <https://github.com/Parallel-in-Time/pySDC/blob/master/pySDC/projects/SDC_showdown/SDC_timing_GrayScott.py>`_
12+
13+
.. literalinclude:: ../../../pySDC/projects/SDC_showdown/SDC_timing_GrayScott.py
14+
15+
Results:
16+
17+
.. image:: ../../../data/timings_SDC_variants_GrayScott.png
18+
:scale: 100 %
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Full code: `pySDC/tutorial/step_7/C_pySDC_with_PETSc.py <https://github.com/Parallel-in-Time/pySDC/blob/master/pySDC/tutorial/step_7/C_pySDC_with_PETSc.py>`_
2+
3+
Results:
4+
5+
1 processor in time, 1 processor in space
6+
.. literalinclude:: ../../../step_7_C_out_1x1.txt
7+
8+
1 processor in time, 2 processors in space
9+
.. literalinclude:: ../../../step_7_C_out_1x2.txt
10+
11+
2 processor in time, 2 processors in space
12+
.. literalinclude:: ../../../step_7_C_out_2x2.txt

pySDC/helpers/plot_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ def savefig(filename, save_pdf=True, save_pgf=True, save_png=True):
6565
plt.savefig('{}.pdf'.format(filename), rasterized=True, bbox_inches='tight')
6666
if save_png:
6767
plt.savefig('{}.png'.format(filename), rasterized=True, bbox_inches='tight')
68+
plt.close()

pySDC/implementations/controller_classes/allinclusive_classic_MPI.py

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -152,35 +152,6 @@ def restart_block(self, size, time, u0):
152152
lvl.status.time = time
153153
lvl.status.sweep = 1
154154

155-
@staticmethod
156-
def recv(target, source, tag, comm):
157-
"""
158-
Receive function
159-
160-
Args:
161-
target: process/level which will receive the values
162-
source: process/level which initiated the send
163-
tag: identifier to check if this message is really for me
164-
comm: communicator
165-
"""
166-
# do a blocking receive and re-compute f(u0)
167-
target.u[0] = comm.recv(source=source, tag=tag)
168-
target.f[0] = target.prob.eval_f(target.u[0], target.time)
169-
170-
@staticmethod
171-
def send(source, target, tag, comm):
172-
"""
173-
Send function
174-
175-
Args:
176-
source: process/level which has the new values
177-
target: process/level which will receive the values
178-
tag: identifier for this message
179-
comm: communicator
180-
"""
181-
# do a blocking send
182-
comm.send(source.uend, dest=target, tag=tag)
183-
184155
def predictor(self, comm):
185156
"""
186157
Predictor function, extracted from the stepwise implementation (will be also used by matrix sweppers)
@@ -199,7 +170,7 @@ def predictor(self, comm):
199170
self.logger.debug('recv data predict: process %s, stage %s, time, %s, source %s, tag %s, phase %s' %
200171
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.prev,
201172
self.S.status.iter, p))
202-
self.recv(target=self.S.levels[-1], source=self.S.prev, tag=self.S.status.iter, comm=comm)
173+
self.S.levels[-1].u[0].recv(source=self.S.prev, tag=self.S.status.iter, comm=comm)
203174

204175
# do the sweep with new values
205176
self.S.levels[-1].sweep.update_nodes()
@@ -209,7 +180,7 @@ def predictor(self, comm):
209180
self.logger.debug('send data predict: process %s, stage %s, time, %s, target %s, tag %s, phase %s' %
210181
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.next,
211182
self.S.status.iter, p))
212-
self.send(source=self.S.levels[-1], target=self.S.next, tag=self.S.status.iter, comm=comm)
183+
self.S.levels[-1].uend.send(dest=self.S.next, tag=self.S.status.iter, comm=comm)
213184

214185
# interpolate back to finest level
215186
for l in range(len(self.S.levels) - 1, 0, -1):
@@ -320,7 +291,7 @@ def pfasst(self, comm, num_procs):
320291
self.logger.debug('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
321292
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.next,
322293
0, self.S.status.iter))
323-
self.req_send.append(comm.isend(self.S.levels[0].uend, dest=self.S.next, tag=0))
294+
self.req_send.append(self.S.levels[0].uend.isend(dest=self.S.next, tag=0, comm=comm))
324295

325296
# update stage
326297
self.S.status.stage = 'IT_CHECK'
@@ -349,7 +320,7 @@ def pfasst(self, comm, num_procs):
349320
self.logger.debug('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
350321
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.next,
351322
l, self.S.status.iter))
352-
self.req_send.append(comm.isend(self.S.levels[l].uend, dest=self.S.next, tag=l))
323+
self.req_send.append(self.S.levels[l].uend.isend(dest=self.S.next, tag=l, comm=comm))
353324

354325
# transfer further up the hierarchy
355326
self.S.transfer(source=self.S.levels[l], target=self.S.levels[l + 1])
@@ -364,7 +335,7 @@ def pfasst(self, comm, num_procs):
364335
self.logger.debug('recv data: process %s, stage %s, time %s, source %s, tag %s, iter %s' %
365336
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.prev,
366337
len(self.S.levels) - 1, self.S.status.iter))
367-
self.recv(target=self.S.levels[-1], source=self.S.prev, tag=len(self.S.levels) - 1, comm=comm)
338+
self.S.levels[-1].u[0].recv(source=self.S.prev, tag=len(self.S.levels) - 1, comm=comm)
368339

369340
# update stage
370341
self.S.status.stage = 'IT_COARSE'
@@ -386,7 +357,7 @@ def pfasst(self, comm, num_procs):
386357
self.logger.debug('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
387358
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.next,
388359
len(self.S.levels) - 1, self.S.status.iter))
389-
self.send(source=self.S.levels[-1], target=self.S.next, tag=len(self.S.levels) - 1, comm=comm)
360+
self.S.levels[-1].uend.send(dest=self.S.next, tag=len(self.S.levels) - 1, comm=comm)
390361

391362
# update stage
392363
self.S.status.stage = 'IT_DOWN'
@@ -402,7 +373,7 @@ def pfasst(self, comm, num_procs):
402373
self.logger.debug('recv data: process %s, stage %s, time %s, source %s, tag %s, iter %s' %
403374
(self.S.status.slot, self.S.status.stage, self.S.time, self.S.prev,
404375
l - 1, self.S.status.iter))
405-
self.recv(target=self.S.levels[l - 1], source=self.S.prev, tag=l - 1, comm=comm)
376+
self.S.levels[l - 1].u[0].recv(source=self.S.prev, tag=l - 1, comm=comm)
406377

407378
# prolong values
408379
self.S.transfer(source=self.S.levels[l], target=self.S.levels[l - 1])

pySDC/implementations/controller_classes/allinclusive_classic_nonMPI.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
import copy as cp
33
import numpy as np
4+
import dill
45

56
from pySDC.core.Controller import controller
67
from pySDC.core import Step as stepclass
@@ -27,10 +28,17 @@ def __init__(self, num_procs, controller_params, description):
2728

2829
self.logger.warning('classic controller is about to become deprecated, use multigrid controller instead')
2930

30-
self.MS = []
31-
# simply append step after step and generate the hierarchies
32-
for p in range(num_procs):
33-
self.MS.append(stepclass.step(description))
31+
self.MS = [stepclass.step(description)]
32+
33+
# try to initialize via dill.copy (much faster for many time-steps)
34+
try:
35+
for p in range(num_procs - 1):
36+
self.MS.append(dill.copy(self.MS[0]))
37+
# if this fails (e.g. due to un-picklable data in the steps), initialize seperately
38+
except dill.PicklingError and TypeError:
39+
self.logger.warning('Need to initialize steps separately due to pickling error')
40+
for p in range(num_procs - 1):
41+
self.MS.append(stepclass.step(description))
3442

3543
assert not (len(self.MS) > 1 and len(self.MS[0].levels) == 1), "ERROR: classic cannot do MSSDC"
3644

0 commit comments

Comments
 (0)