diff --git a/pySDC/helpers/plot_helper.py b/pySDC/helpers/plot_helper.py index 8ddea7cd0c15e260165082a44b4098c73d56ed12..f1a6238dcd196111b43dea4aa13e4292b2a51791 100644 --- a/pySDC/helpers/plot_helper.py +++ b/pySDC/helpers/plot_helper.py @@ -42,6 +42,7 @@ def figsize_by_journal(journal, scale, ratio): # pragma: no cover textwidths = { 'JSC_beamer': 426.79135, 'Springer_Numerical_Algorithms': 338.58778, + 'Springer_proceedings': 347.12354, 'JSC_thesis': 434.26027, 'TUHH_thesis': 426.79135, } @@ -50,6 +51,7 @@ def figsize_by_journal(journal, scale, ratio): # pragma: no cover 'JSC_beamer': 214.43411, 'JSC_thesis': 635.5, 'TUHH_thesis': 631.65118, + 'Springer_proceedings': 549.13828, } assert ( journal in textwidths.keys() diff --git a/pySDC/implementations/convergence_controller_classes/step_size_limiter.py b/pySDC/implementations/convergence_controller_classes/step_size_limiter.py index c3c7ede14513876a263f84edf6b023f7d752505b..10b4cd18b04ce95f9b6dfeff96e7b861abbf146c 100644 --- a/pySDC/implementations/convergence_controller_classes/step_size_limiter.py +++ b/pySDC/implementations/convergence_controller_classes/step_size_limiter.py @@ -192,12 +192,7 @@ class StepSizeRounding(ConvergenceController): def get_new_step_size(self, controller, S, **kwargs): """ - Enforce an upper and lower limit to the step size here. - Be aware that this is only tested when a new step size has been determined. That means if you set an initial - value for the step size outside of the limits, and you don't do any further step size control, that value will - go through. - Also, the final step is adjusted such that we reach Tend as best as possible, which might give step sizes below - the lower limit set here. + Round step size here Args: controller (pySDC.Controller): The controller diff --git a/pySDC/implementations/hooks/log_solution.py b/pySDC/implementations/hooks/log_solution.py index 42755a3287bef46c46629af2c5183cd325239d02..9cd5ba8e8d5394291be78a85e7f59cf85f1b67c4 100644 --- a/pySDC/implementations/hooks/log_solution.py +++ b/pySDC/implementations/hooks/log_solution.py @@ -122,7 +122,7 @@ class LogToFile(Hooks): ) if not os.path.isdir(self.path): - os.mkdir(self.path) + os.makedirs(self.path, exist_ok=True) def log_to_file(self, step, level_number, condition, process_solution=None): if level_number > 0: @@ -188,3 +188,15 @@ class LogToFileAfterXs(LogToFile): if L.time + L.dt >= self.t_next_log and not step.status.restart: super().post_step(step, level_number) self.t_next_log = max([L.time + L.dt, self.t_next_log]) + self.time_increment + + def pre_run(self, step, level_number): + L = step.levels[level_number] + L.uend = L.u[0] + + def process_solution(L): + return { + **type(self).process_solution(L), + 't': L.time, + } + + self.log_to_file(step, level_number, type(self).logging_condition(L), process_solution=process_solution) diff --git a/pySDC/projects/GPU/etc/generate_jobscript.py b/pySDC/projects/GPU/etc/generate_jobscript.py index ff877bfa1e5da0055d33ae2e287ad59994ae2d61..c78e623b1f52fef7a4b762d46c5cbbe82bb52c6b 100644 --- a/pySDC/projects/GPU/etc/generate_jobscript.py +++ b/pySDC/projects/GPU/etc/generate_jobscript.py @@ -9,12 +9,14 @@ def generate_directories(): ''' import os - for name in ['jobscripts', 'slurm-out']: + for name in ['jobscripts', 'slurm-out', 'nsys_profiles']: path = f'{PROJECT_PATH}/etc/{name}' os.makedirs(path, exist_ok=True) -def get_jobscript_text(sbatch_options, srun_options, command, cluster): +def get_jobscript_text( + sbatch_options, srun_options, command, cluster, name='Coffeebreak', nsys_profiling=False, OMP_NUM_THREADS=1 +): """ Generate the text for a jobscript @@ -23,25 +25,33 @@ def get_jobscript_text(sbatch_options, srun_options, command, cluster): srun_options (list): Options for the srun command command (str): python (!) command. Will be prefaced by `python <path>/` cluster (str): Name of the cluster you want to run on + name (str): Jobname + nsys_profiling (bool): Whether to generate an NSIGHT Systems profile Returns: str: Content of jobscript """ msg = '#!/usr/bin/bash\n\n' + msg += f'#SBATCH -J {name}\n' + for op in DEFAULT_SBATCH_OPTIONS + sbatch_options: msg += f'#SBATCH {op}\n' + msg += f'\nexport OMP_NUM_THREADS={OMP_NUM_THREADS}\n' msg += f'\nsource {PROJECT_PATH}/etc/venv_{cluster.lower()}/activate.sh\n' srun_cmd = 'srun' for op in DEFAULT_SRUN_OPTIONS + srun_options: srun_cmd += f' {op}' + if nsys_profiling: + srun_cmd += f' nsys profile --trace=mpi,ucx,cuda,nvtx --output={PROJECT_PATH}/etc/nsys_profiles/{name}.%q{{SLURM_PROCID}}_%q{{SLURM_NTASKS}} --force-overwrite true' + msg += f'\n{srun_cmd} python {PROJECT_PATH}/{command}' return msg -def write_jobscript(sbatch_options, srun_options, command, cluster, submit=True): +def write_jobscript(sbatch_options, srun_options, command, cluster, submit=True, **kwargs): """ Generate a jobscript. @@ -54,11 +64,12 @@ def write_jobscript(sbatch_options, srun_options, command, cluster, submit=True) """ generate_directories() - text = get_jobscript_text(sbatch_options, srun_options, command, cluster) + text = get_jobscript_text(sbatch_options, srun_options, command, cluster, **kwargs) path = f'{PROJECT_PATH}/etc/jobscripts/{command.replace(" ", "").replace("/", "_")}-{cluster}.sh' with open(path, 'w') as file: file.write(text) + print(f'Written jobscript {path!r}') if submit: import os diff --git a/pySDC/projects/GPU/etc/venv_booster/modules.sh b/pySDC/projects/GPU/etc/venv_booster/modules.sh index bbadd908dd9a909dadde2492cc8c10ed88d95055..b8a11a925e9f212cf1fd4a2bfb0d34d2eeb8a53a 100644 --- a/pySDC/projects/GPU/etc/venv_booster/modules.sh +++ b/pySDC/projects/GPU/etc/venv_booster/modules.sh @@ -11,3 +11,4 @@ module load FFTW module load mpi4py module load FFmpeg/.6.0 module load SciPy-Stack +module load texlive diff --git a/pySDC/projects/GPU/etc/venv_jusuf/modules.sh b/pySDC/projects/GPU/etc/venv_jusuf/modules.sh index 85ec025c8ec03326d9d24b655f9d79b691679285..5d3e339756c4ccaffbcb4c51658039300e7b44ee 100644 --- a/pySDC/projects/GPU/etc/venv_jusuf/modules.sh +++ b/pySDC/projects/GPU/etc/venv_jusuf/modules.sh @@ -10,4 +10,5 @@ module load Python module load FFTW module load mpi4py module load FFmpeg/.6.0 -module load SciPy-Stack +# module load SciPy-Stack +module load texlive diff --git a/pySDC/projects/GPU/etc/venv_jusuf/setup.sh b/pySDC/projects/GPU/etc/venv_jusuf/setup.sh index 7a1378cdf015caf01c3ab3b78f5a8125d13b3049..40224178d7cbd913973335816b860c4baf3f59c9 100755 --- a/pySDC/projects/GPU/etc/venv_jusuf/setup.sh +++ b/pySDC/projects/GPU/etc/venv_jusuf/setup.sh @@ -16,4 +16,3 @@ FFTW_LIBRARY_DIR="/p/software/jusuf/stages/2024/software/FFTW/3.3.10-GCC-12.3.0/ python3 -m pip install -e /p/project1/ccstma/baumann7/qmat python3 -m pip install -r "${ABSOLUTE_PATH}"/requirements.txt python3 -m pip install -e /p/project1/ccstma/baumann7/pySDC/ - diff --git a/pySDC/projects/Resilience/sweepers.py b/pySDC/projects/Resilience/sweepers.py index ac2f54486e6957d2092461d8c4d6fd3d13997e08..3919a743310c6d02edc94bbc9104d3cb908985d6 100644 --- a/pySDC/projects/Resilience/sweepers.py +++ b/pySDC/projects/Resilience/sweepers.py @@ -26,6 +26,10 @@ class efficient_sweeper: if self.params.initial_guess == 'spread': L.u[m] = P.dtype_u(L.u[0]) L.f[m] = P.eval_f(L.u[m], L.time + L.dt * self.coll.nodes[m - 1]) + elif self.params.initial_guess == 'copy': + L.f[0] = P.eval_f(L.u[0], L.time) + L.u[m] = P.dtype_u(L.u[0]) + L.f[m] = P.dtype_f(L.f[0]) # start with zero everywhere elif self.params.initial_guess == 'zero': L.u[m] = P.dtype_u(init=P.init, val=0.0) diff --git a/pySDC/projects/Resilience/venv/modules.sh b/pySDC/projects/Resilience/venv/modules.sh index 59522b0904d7bd3eda0ac89304b5119ab79b97fc..07e78de848ac401b5d09c0df8726be6fd0154e2e 100644 --- a/pySDC/projects/Resilience/venv/modules.sh +++ b/pySDC/projects/Resilience/venv/modules.sh @@ -6,3 +6,4 @@ module load FFTW module load Python/3.11.3 module load mpi4py module load FFmpeg/.6.0 +module load texlive diff --git a/pySDC/tests/test_convergence_controllers/test_step_size_limiter.py b/pySDC/tests/test_convergence_controllers/test_step_size_limiter.py index 618fbea66edd3e5729ef353acdee3f6b5523c750..dc528c505d98d2efbedeaaabcd47556e543fcd4b 100644 --- a/pySDC/tests/test_convergence_controllers/test_step_size_limiter.py +++ b/pySDC/tests/test_convergence_controllers/test_step_size_limiter.py @@ -80,6 +80,11 @@ def test_step_size_slope_limiter(): limiter.get_new_step_size(controller, S) assert L.status.dt_new == 1 + L.params.dt = 1 + L.status.dt_new = 1 - 1e-1 + limiter.get_new_step_size(controller, S) + assert L.status.dt_new == 1 + @pytest.mark.base def test_step_size_limiter():