Skip to content

Commit ef6c24c

Browse files
committed
Few fixes
1 parent e26d0ca commit ef6c24c

File tree

5 files changed

+45
-11
lines changed

5 files changed

+45
-11
lines changed

pySDC/implementations/hooks/log_solution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def pre_run(self, step, level_number):
239239
self.logger.info(f'Written initial conditions at t={L.time:4f} to file')
240240

241241
type(self).counter = len(self.outfile.times)
242+
self.logger.info(f'Will write to disk every {self.time_increment:.4e} time units')
242243

243244
def post_step(self, step, level_number):
244245
if level_number > 0:

pySDC/implementations/problem_classes/RayleighBenard.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,6 @@ def processSolutionForOutput(self, u):
403403
me[:-1] = u_real
404404
me[-1] = vorticity
405405
return me
406-
print(u.shape, vorticity.shape)
407-
exit()
408-
if self.spectral_space:
409-
return np.array(self.itransform(u).real)
410-
else:
411-
return np.array(u.real)
412406

413407
def compute_Nusselt_numbers(self, u):
414408
"""

pySDC/projects/GPU/configs/base_config.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,13 @@ def setup(self, controller, params, *args, **kwargs):
224224
def post_step_processing(self, controller, S, **kwargs):
225225
hook = self.params.hook
226226

227-
for _hook in controller.hooks:
228-
_hook.post_step(S, 0)
229-
230227
P = S.levels[0].prob
231228

232-
if S.time > 0 and self.counter == 0:
229+
if self.counter == 0:
233230
self.counter = hook.counter - 1
231+
234232
while self.counter < hook.counter:
235-
path = self.get_stats_path(index=self.counter)
233+
path = self.get_stats_path(index=self.counter - 1)
236234
stats = controller.return_stats()
237235
store = True
238236
if hasattr(S.levels[0].sweep, 'comm') and S.levels[0].sweep.comm.rank > 0:

pySDC/projects/GPU/run_experiment.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ def str_to_procs(me):
3232

3333
def run_experiment(args, config, **kwargs):
3434
import pickle
35+
import os
3536

3637
# from pySDC.implementations.controller_classes.controller_MPI import controller_MPI
3738
from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI
3839
from pySDC.helpers.stats_helper import filter_stats
3940

4041
type(config).base_path = args['o']
42+
os.makedirs(f'{args["o"]}/data', exist_ok=True)
43+
4144
description = config.get_description(
4245
useGPU=args['useGPU'], MPIsweeper=args['procs'][1] > 1, res=args['res'], **kwargs
4346
)

pySDC/projects/GPU/tests/test_configs.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,41 @@ def create_directories():
3535
os.makedirs(path, exist_ok=True)
3636

3737

38+
def test_run(tmpdir):
39+
from pySDC.projects.GPU.configs.base_config import get_config
40+
from pySDC.projects.GPU.run_experiment import run_experiment
41+
42+
args = {
43+
'config': 'RBC',
44+
'procs': [1, 1, 1],
45+
'res': 16,
46+
'mode': 'run',
47+
'useGPU': False,
48+
'o': tmpdir,
49+
'logger_level': 15,
50+
'restart_idx': 0,
51+
}
52+
config = get_config(args)
53+
54+
def get_LogToFile(self, *args, **kwargs):
55+
if self.comms[1].rank > 0:
56+
return None
57+
from pySDC.implementations.hooks.log_solution import LogToFile
58+
59+
LogToFile.filename = self.get_file_name()
60+
LogToFile.time_increment = 0
61+
LogToFile.allow_overwriting = True
62+
63+
return LogToFile
64+
65+
type(config).get_LogToFile = get_LogToFile
66+
67+
# first run for a short time
68+
dt = config.get_description()['level_params']['dt']
69+
config.Tend = 2 * dt
70+
run_experiment(args, config)
71+
72+
3873
@pytest.mark.order(1)
3974
def test_run_experiment(restart_idx=0):
4075
from pySDC.projects.GPU.configs.base_config import Config
@@ -108,6 +143,9 @@ def test_restart():
108143

109144

110145
if __name__ == '__main__':
146+
test_run('.')
147+
exit()
148+
111149
import argparse
112150

113151
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)