From 169e465d4572f5ddee01f4e3bb5dbc8d80f109ba Mon Sep 17 00:00:00 2001 From: Javier Cladellas Date: Tue, 17 Dec 2024 17:21:12 +0100 Subject: [PATCH 1/2] add memory #176 --- config/toolbox_heat/thermal_bridges_case_3.json | 3 ++- src/feelpp/benchmarking/reframe/config/configSchemas.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/toolbox_heat/thermal_bridges_case_3.json b/config/toolbox_heat/thermal_bridges_case_3.json index 40992688..62bd4f12 100644 --- a/config/toolbox_heat/thermal_bridges_case_3.json +++ b/config/toolbox_heat/thermal_bridges_case_3.json @@ -3,6 +3,7 @@ "output_directory": "{{machine.output_app_dir}}/toolboxes/heat/ThermalBridgesENISO10211/Case3", "use_case_name": "ThermalBridgesENISO10211", "timeout":"0-00:10:00", + "memory":"250G", "platforms": { "apptainer":{ "image": { @@ -31,7 +32,7 @@ "--heat.json.patch='{\"op\": \"replace\",\"path\": \"/Meshes/heat/Import/filename\",\"value\": \"{{platforms.{{machine.platform}}.input_dir}}/partitioning/case3/{{parameters.meshes.value}}/case3_p{{parameters.nb_tasks.tasks.value}}.json\" }'" ], "env_variables":{ - "OMP_NUM_THREADS":1 + "OMP_NUM_THREADS":"1" }, "outputs": [ { diff --git a/src/feelpp/benchmarking/reframe/config/configSchemas.py b/src/feelpp/benchmarking/reframe/config/configSchemas.py index bc7a8dbd..a318478f 100644 --- a/src/feelpp/benchmarking/reframe/config/configSchemas.py +++ b/src/feelpp/benchmarking/reframe/config/configSchemas.py @@ -82,6 +82,7 @@ class AdditionalFiles(BaseModel): class ConfigFile(BaseModel): executable: str timeout: str + memory: Optional[str] = None platforms:Optional[Dict[str,Platform]] = {"builtin":Platform()} output_directory:Optional[str] = "" use_case_name: str From a50f1c4bbf99d0138097fec310521e96cc6ef2c3 Mon Sep 17 00:00:00 2001 From: Javier Cladellas Date: Tue, 17 Dec 2024 17:22:15 +0100 Subject: [PATCH 2/2] add memory to job options #176 This should be generalized... Not scalable atm --- src/feelpp/benchmarking/reframe/__main__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/feelpp/benchmarking/reframe/__main__.py b/src/feelpp/benchmarking/reframe/__main__.py index fb691959..203e8f1e 100644 --- a/src/feelpp/benchmarking/reframe/__main__.py +++ b/src/feelpp/benchmarking/reframe/__main__.py @@ -42,7 +42,17 @@ def buildExecutionMode(self): else: return "-r" - def buildCommand(self,timeout): + def buildJobOptions(self,timeout,memory): + #TODO: Generalize (only workf for slurm ?) + options = [] + if timeout: + options.append(f"-J time={timeout}") + if memory: + options.append(f"-J mem={memory}") + return " ".join(options) + + + def buildCommand(self,timeout,memory): assert self.report_folder_path is not None, "Report folder path not set" cmd = [ 'reframe', @@ -53,7 +63,7 @@ def buildCommand(self,timeout): f'--exec-policy={self.machine_config.execution_policy}', f'--prefix={self.machine_config.reframe_base_dir}', f'--report-file={str(os.path.join(self.report_folder_path,"reframe_report.json"))}', - f"-J '#SBATCH --time={timeout}'", + f"{self.buildJobOptions(timeout,memory)}", f'--perflogdir={os.path.join(self.machine_config.reframe_base_dir,"logs")}', f'{"-"+"v"*self.parser.args.verbose if self.parser.args.verbose else ""}', f'{self.buildExecutionMode()}' @@ -97,7 +107,7 @@ def main_cli(): app_reader.updateConfig(machine_reader.processor.flattenDict(machine_reader.config,"machine")) app_reader.updateConfig() #Update with own field - reframe_cmd = cmd_builder.buildCommand( app_reader.config.timeout ) + reframe_cmd = cmd_builder.buildCommand( app_reader.config.timeout, app_reader.config.memory) exit_code = os.system(reframe_cmd)