Skip to content

Commit 87a3ae5

Browse files
author
dtyagi
committed
reverting to the previous workflow.config setup
1 parent 73a381d commit 87a3ae5

File tree

6 files changed

+26
-63
lines changed

6 files changed

+26
-63
lines changed

benchmarks/common/summarize_results.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def create_summary(configurations: list[str],
66
mesh_files: list[str],
77
solution_metrics: list[str],
88
solution_field_data: list[str],
9-
benchmark_and_tool_metadata: str,
10-
tool: str,
9+
benchmark: str,
10+
benchmark_uri: str,
1111
summary_json: str) -> None:
1212

1313
"""
@@ -19,25 +19,17 @@ def create_summary(configurations: list[str],
1919
mesh_files: List of paths to mesh files
2020
solution_metrics: List of paths to metrics JSON files
2121
solution_field_data: List of paths to solution field data files
22-
benchmark_and_tool_metadata: Path to the benchmark and tool metadata file
22+
benchmark: Name of the benchmark
23+
benchmark_uri: URI of the benchmark
2324
summary_json: Output path for the summary JSON file
2425
"""
2526

26-
with open(benchmark_and_tool_metadata, "r") as metadata_file:
27-
metadata = json.load(metadata_file)
28-
benchmark = metadata["benchmark"]
29-
benchmark_uri = metadata["benchmark_uri"]
30-
tool_uri = metadata.get(tool).get("tool_uri")
31-
tool_version = metadata.get(tool).get("tool_version")
32-
27+
3328
all_summaries = []
3429
for idx, config in enumerate(configurations):
3530
summary = {}
3631
summary["benchmark"] = benchmark
3732
summary["benchmark_uri"] = benchmark_uri
38-
summary["tool"] = tool
39-
summary["tool_version"] = tool_version
40-
summary["tool_uri"] = tool_uri
4133
with open(parameter_files[idx], "r") as param_file:
4234
summary["parameters"] = json.load(param_file)
4335
summary["mesh"] = f"{config}/mesh"
@@ -60,10 +52,7 @@ def create_summary(configurations: list[str],
6052
parser.add_argument("--input_mesh_file", nargs="+", type=str, required=True, help="Path to the mesh file (input)")
6153
parser.add_argument("--input_solution_metrics", nargs="+", type=str, required=True, help="Path to the metrics JSON file (input)")
6254
parser.add_argument("--input_solution_field_data", nargs="+", type=str, required=True, help="Path to the zipped solution files (input)")
63-
parser.add_argument("--input_benchmark_and_tool_metadata", required=True, type=str, help="Path to the benchmark and tool metadata file (input)")
64-
parser.add_argument("--input_tool", required=True, type=str, help="Name of the tool (input)")
65-
#parser.add_argument("--input_benchmark", required=True, type=str, help="Name of the benchmark (input)")
66-
#parser.add_argument("--input_benchmark_uri", required=True, type=str, help="URI of the benchmark (input)")
55+
parser.add_argument("--input_benchmark", required=True, type=str, help="Name of the benchmark (input)")
6756
parser.add_argument("--output_summary_json", required=True, type=str, help="Path to the summary JSON file (output)")
6857
args = parser.parse_args()
6958
create_summary(
@@ -72,7 +61,6 @@ def create_summary(configurations: list[str],
7261
args.input_mesh_file,
7362
args.input_solution_metrics,
7463
args.input_solution_field_data,
75-
args.input_benchmark_and_tool_metadata,
76-
args.input_tool,
64+
args.input_benchmark,
7765
args.output_summary_json
7866
)

benchmarks/linear-elastic-plate-with-hole/Snakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ configuration_to_parameter_file = config["configuration_to_parameter_file"]
66
configurations = config["configurations"]
77
tools = config["tools"]
88
benchmark = config["benchmark"]
9+
benchmark_uri = config["benchmark_uri"]
910

1011

1112
rule all:
@@ -52,7 +53,6 @@ rule summary:
5253
f"{result_dir}/{{tool}}/solution_field_data_{{configuration}}.zip",
5354
tool=[wildcards.tool], configuration=configurations
5455
),
55-
benchmark_and_tool_metadata_file = f"benchmark_and_tool_metadata.json",
5656
output:
5757
summary_json = f"{result_dir}/{{tool}}/summary.json",
5858
conda: "environment_postprocessing.yml",
@@ -64,8 +64,8 @@ rule summary:
6464
--input_mesh_file {input.mesh} \
6565
--input_solution_metrics {input.metrics} \
6666
--input_solution_field_data {input.solution_field_data} \
67-
--input_benchmark_and_tool_metadata {input.benchmark_and_tool_metadata_file} \
68-
--input_tool {wildcards.tool} \
67+
--input_benchmark {benchmark} \
68+
--input_benchmark_uri {benchmark_uri} \
6969
--output_summary_json {output.summary_json}
7070
"""
7171

benchmarks/linear-elastic-plate-with-hole/generate_config.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def get_configuration(file):
4040
configuration_to_parameter_file = {v: str(k) for k, v in configurations.items()}
4141

4242
tools = ["fenics", "kratos"]
43-
tools_uri = ["https://github.com/FEniCS/dolfinx", "https://github.com/KratosMultiphysics/Kratos"]
44-
software_versions = ["0.9", "10.3.1"]
4543
benchmark = "linear-elastic-plate-with-hole"
4644
benchmark_uri = "https://portal.mardi4nfdi.de/wiki/Model:6775296"
4745

@@ -51,27 +49,9 @@ def get_configuration(file):
5149
"configurations": list(configurations.values()),
5250
"tools": tools,
5351
"benchmark": benchmark,
52+
"benchmark_uri": benchmark_uri
5453
}
5554

5655
# Write workflow configuration file
5756
with open("workflow_config.json", "w") as f:
58-
json.dump(workflow_config, f, indent=4)
59-
60-
benchmark_and_tool_metadata = {}
61-
62-
# Create tool entries using loops
63-
for i, tool in enumerate(tools):
64-
benchmark_and_tool_metadata[tool] = {
65-
"tool_uri": tools_uri[i],
66-
"tool_version": software_versions[i]
67-
}
68-
69-
# Add the remaining metadata
70-
benchmark_and_tool_metadata.update({
71-
"benchmark": benchmark,
72-
"benchmark_uri": benchmark_uri,
73-
})
74-
75-
# Write benchmark_and_tool_metadata configuration file
76-
with open("benchmark_and_tool_metadata.json", "w") as f:
77-
json.dump(benchmark_and_tool_metadata, f, indent=4)
57+
json.dump(workflow_config, f, indent=4)

benchmarks/linear-elastic-plate-with-hole/main.nf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ process summary{
3333
val mesh_file
3434
val solution_metrics
3535
val solution_field_data
36-
path benchmark_and_tool_metadata
36+
val benchmark
37+
val benchmark_uri
3738
val tool
3839

3940
output:
@@ -47,8 +48,8 @@ process summary{
4748
--input_mesh_file ${mesh_file.join(' ')} \
4849
--input_solution_metrics ${solution_metrics.join(' ')} \
4950
--input_solution_field_data ${solution_field_data.join(' ')} \
50-
--input_benchmark_and_tool_metadata ${benchmark_and_tool_metadata} \
51-
--input_tool ${tool} \
51+
--input_benchmark ${benchmark} \
52+
--input_benchmark_uri ${benchmark_uri} \
5253
--output_summary_json "summary.json"
5354
5455
"""
@@ -137,17 +138,17 @@ workflow {
137138
input_summary_metrics = fenics_summary_metrics.concat(kratos_summary_metrics)
138139

139140
//Summarizing results
140-
//def ch_benchmark = Channel.value(params.benchmark)
141-
//def ch_benchmark_uri = Channel.value(params.benchmark_uri)
142-
def ch_benchmark_and_tool_metadata_file = Channel.value(file('benchmark_and_tool_metadata.json'))
141+
def ch_benchmark = Channel.value(params.benchmark)
142+
def ch_benchmark_uri = Channel.value(params.benchmark_uri)
143143
def ch_summarize_python_script = Channel.value(file('../common/summarize_results.py'))
144144
summary(ch_summarize_python_script, \
145145
input_summary_configuration, \
146146
input_summary_parameter_file, \
147147
input_summary_mesh, \
148148
input_summary_metrics, \
149149
input_summary_solution_field, \
150-
ch_benchmark_and_tool_metadata_file, \
150+
ch_benchmark, \
151+
ch_benchmark_uri, \
151152
ch_tools)
152153

153154
}
@@ -169,4 +170,4 @@ be matched with their corresponding inputs using a common key.
169170
170171
Information on channel operations: https://www.nextflow.io/docs/latest/reference/operator.html
171172
Information on channels: https://training.nextflow.io/2.2/basic_training/channels/
172-
*/
173+
*/

docs/getting_started/benchmark_addition_guide.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ The steps are as follows:
2424
2525
4. **Create a script for discovering the configurations**
2626
27-
- Create the script `generate_config.py` in `benchmarks/problem/`.
28-
- The script should:
29-
- Discover all the parameter configuration JSON files.
30-
- Extract configurations.
31-
- List the simulation tools for each configuration, cf. [generate_config.py](https://github.com/BAMresearch/NFDI4IngModelValidationPlatform/blob/main/benchmarks/linear-elastic-plate-with-hole/generate_config.py).
27+
- Copy the script `benchmarks/linear-elastic-plate-with-hole/generate_config.py` to `benchmarks/problem_name/`.
28+
- Modify the list of simulation tools for the benchmark, cf. [generate_config.py](https://github.com/BAMresearch/NFDI4IngModelValidationPlatform/blob/main/benchmarks/linear-elastic-plate-with-hole/generate_config.py).
3229
33-
**Note:** The simulation-tool-specific keywords are used by the main workflow to call the corresponding sub-workflows.
30+
**Note:** The simulation-tool-specific keywords are used by the main workflow to call the corresponding sub-workflows.
31+
32+
**Note:** In the future, the file will be moved to the `benchmarks/common/`folder and the list of simulation tools which is benchmark-specific will be provided separately.
3433
3534
5. **Create the mesh generation script**
3635

mkdocs.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ markdown_extensions:
3131
enable_dollar_delimiter: true
3232
- pymdownx.tasklist:
3333
- pymdownx.superfences
34-
#- pymdownx.snippets:
35-
# check_paths: true
36-
#- pymdownx.inlinehilite
37-
# custom_checkbox: true
38-
#- markdown_checklist.extension
3934

4035
nav:
4136
- index.md

0 commit comments

Comments
 (0)