From 4d59722afbbdfb9b3b2626828362a4ddafd80a22 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Tue, 9 Mar 2021 10:03:03 +0000 Subject: [PATCH] #num_threads is now #cpu_threads --- gprMax/hash_cmds_file.py | 26 ++++++++++++++++++++++---- gprMax/hash_cmds_singleuse.py | 10 +++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gprMax/hash_cmds_file.py b/gprMax/hash_cmds_file.py index 094109f7..30e17b7d 100644 --- a/gprMax/hash_cmds_file.py +++ b/gprMax/hash_cmds_file.py @@ -200,14 +200,32 @@ def check_cmd_names(processedlines, checkessential=True): essentialcmds = ['#domain', '#dx_dy_dz', '#time_window'] # Commands that there should only be one instance of in a model - singlecmds = dict.fromkeys(['#domain', '#dx_dy_dz', '#time_window', '#title', '#messages', '#num_threads', '#time_step_stability_factor', '#pml_formulation', '#pml_cells', '#excitation_file', '#src_steps', '#rx_steps', '#output_dir'], None) + singlecmds = dict.fromkeys(['#domain', '#dx_dy_dz', '#time_window', + '#title', '#cpu_threads', + '#time_step_stability_factor', + '#pml_formulation', '#pml_cells', + '#excitation_file', '#src_steps', '#rx_steps', + '#output_dir'], None) - # Commands that there can be multiple instances of in a model - these will be lists within the dictionary - multiplecmds = {key: [] for key in ['#geometry_view', '#geometry_objects_write', '#material', '#soil_peplinski', '#add_dispersion_debye', '#add_dispersion_lorentz', '#add_dispersion_drude', '#waveform', '#voltage_source', '#hertzian_dipole', '#magnetic_dipole', '#transmission_line', '#rx', '#rx_array', '#snapshot', '#include_file']} + # Commands that there can be multiple instances of in a model + # - these will be lists within the dictionary + multiplecmds = {key: [] for key in ['#geometry_view', + '#geometry_objects_write', '#material', + '#soil_peplinski', + '#add_dispersion_debye', + '#add_dispersion_lorentz', + '#add_dispersion_drude', + '#waveform', '#voltage_source', + '#hertzian_dipole', '#magnetic_dipole', + '#transmission_line', '#rx', '#rx_array', + '#snapshot', '#include_file']} # Geometry object building commands that there can be multiple instances # of in a model - these will be lists within the dictionary - geometrycmds = ['#geometry_objects_read', '#edge', '#plate', '#triangle', '#box', '#sphere', '#cylinder', '#cylindrical_sector', '#fractal_box', '#add_surface_roughness', '#add_surface_water', '#add_grass'] + geometrycmds = ['#geometry_objects_read', '#edge', '#plate', '#triangle', + '#box', '#sphere', '#cylinder', '#cylindrical_sector', + '#fractal_box', '#add_surface_roughness', + '#add_surface_water', '#add_grass'] # List to store all geometry object commands in order from input file geometry = [] diff --git a/gprMax/hash_cmds_singleuse.py b/gprMax/hash_cmds_singleuse.py index 9170a793..90d6f97f 100644 --- a/gprMax/hash_cmds_singleuse.py +++ b/gprMax/hash_cmds_singleuse.py @@ -19,7 +19,7 @@ import logging from .cmds_singleuse import (Discretisation, Domain, ExcitationFile, - NumThreads, OutputDir, PMLCells, RxSteps, + OMPThreads, OutputDir, PMLCells, RxSteps, SrcSteps, TimeStepStabilityFactor, TimeWindow, Title) @@ -52,15 +52,15 @@ def process_singlecmds(singlecmds): scene_objects.append(output_dir) # Number of threads for CPU-based (OpenMP) parallelised parts of code - cmd = '#num_threads' + cmd = '#cpu_threads' if singlecmds[cmd] is not None: tmp = tuple(int(x) for x in singlecmds[cmd].split()) if len(tmp) != 1: - logger.exception(cmd + ' requires exactly one parameter to specify the number of threads to use') + logger.exception(cmd + ' requires exactly one parameter to specify the number of CPU OpenMP threads to use') raise ValueError - num_thread = NumThreads(n=tmp[0]) - scene_objects.append(num_thread) + omp_threads = OMPThreads(n=tmp[0]) + scene_objects.append(omp_threads) cmd = '#dx_dy_dz' if singlecmds[cmd] is not None: