Skip to content

Commit 5a890df

Browse files
author
Thomas
committed
Changed configurations a bit
1 parent 01d0346 commit 5a890df

File tree

3 files changed

+54
-23
lines changed

3 files changed

+54
-23
lines changed

pySDC/projects/GPU/analysis_scripts/parallel_scaling.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ScalingConfig(object):
1818
tasks_time = 1
1919
max_steps_space = None
2020
max_steps_space_weak = None
21+
sbatch_options = []
2122

2223
def __init__(self, space_time_parallel):
2324
if space_time_parallel in ['False', False]:
@@ -36,9 +37,9 @@ def run_scaling_test(self, strong=True):
3637
for i in range(max_steps):
3738
res, procs = self.get_resolution_and_tasks(strong, i)
3839

39-
sbatch_options = [f'-n {np.prod(procs)}', f'-p {self.partition}']
40+
sbatch_options = [f'-n {np.prod(procs)}', f'-p {self.partition}'] + self.sbatch_options
4041
if self.useGPU:
41-
srun_options = ['--cpus-per-task=4', '--gpus-per-task=1']
42+
srun_options = ['--cpus-per-task=4', '--gpus-per-task=1'] + self.sbatch_options
4243
sbatch_options += ['--cpus-per-task=4', '--gpus-per-task=1']
4344
else:
4445
srun_options = []
@@ -51,7 +52,7 @@ def run_scaling_test(self, strong=True):
5152

5253
write_jobscript(sbatch_options, srun_options, command, self.cluster)
5354

54-
def plot_scaling_test(self, strong, ax, plot_ideal=False, **plotting_params):
55+
def plot_scaling_test(self, strong, ax, plot_ideal=False, **plotting_params): # pragma: no cover
5556
timings = {}
5657

5758
max_steps = self.max_steps_space if strong else self.max_steps_space_weak
@@ -63,12 +64,15 @@ def plot_scaling_test(self, strong, ax, plot_ideal=False, **plotting_params):
6364
config = get_config(args)
6465

6566
path = f'data/{config.get_path(ranks=[me -1 for me in procs])}-stats-whole-run.pickle'
66-
with open(path, 'rb') as file:
67-
stats = pickle.load(file)
67+
try:
68+
with open(path, 'rb') as file:
69+
stats = pickle.load(file)
6870

69-
timing_step = get_sorted(stats, type='timing_step')
71+
timing_step = get_sorted(stats, type='timing_step')
7072

71-
timings[np.prod(procs) / self.tasks_per_node] = np.mean([me[1] for me in timing_step])
73+
timings[np.prod(procs) / self.tasks_per_node] = np.mean([me[1] for me in timing_step])
74+
except FileNotFoundError:
75+
pass
7276

7377
ax.loglog(timings.keys(), timings.values(), **plotting_params)
7478
if plot_ideal:
@@ -86,7 +90,8 @@ def plot_scaling_test(self, strong, ax, plot_ideal=False, **plotting_params):
8690
class CPUConfig(ScalingConfig):
8791
cluster = 'jusuf'
8892
partition = 'batch'
89-
tasks_per_node = 128
93+
tasks_per_node = 16
94+
sbatch_options = ['--tasks-per-node=16']
9095

9196

9297
class GPUConfig(ScalingConfig):
@@ -97,7 +102,7 @@ class GPUConfig(ScalingConfig):
97102

98103

99104
class GrayScottSpaceScalingCPU(CPUConfig, ScalingConfig):
100-
base_resolution = 2048
105+
base_resolution = 4096
101106
base_resolution_weak = 256
102107
config = 'GS_scaling'
103108
max_steps_space = 10
@@ -106,15 +111,15 @@ class GrayScottSpaceScalingCPU(CPUConfig, ScalingConfig):
106111

107112

108113
class GrayScottSpaceScalingGPU(GPUConfig, ScalingConfig):
109-
base_resolution_weak = 256 * 32
110-
base_resolution = 2048
114+
base_resolution_weak = 256 * 2
115+
base_resolution = 4096
111116
config = 'GS_scaling'
112-
max_steps_space = 4
117+
max_steps_space = 6
113118
max_steps_space_weak = 4
114119
tasks_time = 3
115120

116121

117-
def plot_scalings(strong, problem, kwargs):
122+
def plot_scalings(strong, problem, kwargs): # pragma: no cover
118123
if problem == 'GS':
119124
fig, ax = plt.subplots()
120125

pySDC/projects/GPU/configs/GS_configs.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def get_description(self, *args, res=-1, **kwargs):
144144

145145

146146
class GrayScott_dt_adaptivity(GrayScott):
147+
"""
148+
Configuration with dt adaptivity added to base configuration
149+
"""
150+
147151
def get_description(self, *args, **kwargs):
148152
from pySDC.implementations.convergence_controller_classes.adaptivity import Adaptivity
149153

@@ -153,6 +157,10 @@ def get_description(self, *args, **kwargs):
153157

154158

155159
class GrayScott_GoL(GrayScott):
160+
'''
161+
This configuration shows gliders that are similar in complexity to Conway's Game of life.
162+
'''
163+
156164
num_frames = 400
157165
res_per_blob = 2**8
158166

@@ -171,7 +179,7 @@ class GrayScott_USkate(GrayScott):
171179
See arXiv:1501.01990 or http://www.mrob.com/sci/papers/2009smp-figs/index.html
172180
'''
173181

174-
num_frames = 200
182+
num_frames = 400
175183
res_per_blob = 2**7
176184

177185
def get_description(self, *args, **kwargs):
@@ -183,7 +191,7 @@ def get_description(self, *args, **kwargs):
183191
desc['problem_params']['Du'] = 2e-5
184192
desc['problem_params']['Dv'] = 1e-5
185193
desc['convergence_controllers'][Adaptivity] = {'e_tol': 1e-3}
186-
self.Tend = 100000
194+
self.Tend = 200000
187195
return desc
188196

189197

@@ -193,7 +201,7 @@ def get_description(self, *args, **kwargs):
193201
desc['problem_params']['L'] = 2
194202
desc['problem_params']['num_blobs'] = 4
195203
desc['sweeper_params']['skip_residual_computation'] = ('IT_CHECK', 'IT_DOWN', 'IT_UP', 'IT_FINE', 'IT_COARSE')
196-
self.Tend = 100 * desc['level_params']['dt']
204+
self.Tend = 50 * desc['level_params']['dt']
197205
return desc
198206

199207
def get_controller_params(self, *args, **kwargs):

pySDC/projects/GPU/etc/generate_jobscript.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55

66
def generate_directories():
7+
'''
8+
Initialize directories for jobscripts and slurm output
9+
'''
710
import os
811

912
for name in ['jobscripts', 'slurm-out']:
@@ -12,6 +15,18 @@ def generate_directories():
1215

1316

1417
def get_jobscript_text(sbatch_options, srun_options, command, cluster):
18+
"""
19+
Generate the text for a jobscript
20+
21+
Args:
22+
sbatch_options (list): List of options for sbatch
23+
srun_options (list): Options for the srun command
24+
command (str): python (!) command. Will be prefaced by `python <path>/`
25+
cluster (str): Name of the cluster you want to run on
26+
27+
Returns:
28+
str: Content of jobscript
29+
"""
1530
msg = '#!/usr/bin/bash\n\n'
1631
for op in DEFAULT_SBATCH_OPTIONS + sbatch_options:
1732
msg += f'#SBATCH {op}\n'
@@ -27,6 +42,16 @@ def get_jobscript_text(sbatch_options, srun_options, command, cluster):
2742

2843

2944
def write_jobscript(sbatch_options, srun_options, command, cluster, submit=True):
45+
"""
46+
Generate a jobscript.
47+
48+
Args:
49+
sbatch_options (list): List of options for sbatch
50+
srun_options (list): Options for the srun command
51+
command (str): python (!) command. Will be prefaced by `python <path>/`
52+
cluster (str): Name of the cluster you want to run on
53+
submit (bool): If yes, the script will be submitted to SLURM after it is written
54+
"""
3055
generate_directories()
3156

3257
text = get_jobscript_text(sbatch_options, srun_options, command, cluster)
@@ -39,10 +64,3 @@ def write_jobscript(sbatch_options, srun_options, command, cluster, submit=True)
3964
import os
4065

4166
os.system(f'sbatch {path}')
42-
43-
44-
if __name__ == '__main__':
45-
sbatch_options = ['--nodes=1']
46-
srun_options = []
47-
command = 'run_problems.py'
48-
write_jobscript(sbatch_options, srun_options, command, 'jusuf')

0 commit comments

Comments
 (0)