From 88c20fbf0339dd64fa314d164fb0894ac7effad9 Mon Sep 17 00:00:00 2001 From: Rodrigo Ceccato de Freitas <29164832+rodrigo-ceccato@users.noreply.github.com> Date: Tue, 30 Jul 2024 16:43:07 -0300 Subject: [PATCH] Replace JSON configuration with YAML file (#15) Switch from JSON to YAML configuration for improved readability (#15) This change replaces the JSON configuration files with YAML files, which are more human-readable. This update is related to issue #13. --- README.md | 4 +- spinner/bench_settings.json | 79 ------------------------------------- spinner/bench_settings.yaml | 51 ++++++++++++++++++++++++ spinner/runner/utilities.py | 4 +- 4 files changed, 55 insertions(+), 83 deletions(-) delete mode 100644 spinner/bench_settings.json create mode 100644 spinner/bench_settings.yaml diff --git a/README.md b/README.md index 640f73e..45d6e55 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ source .venv/bin/activate ## Running ```sh -python3 spinner/main.py -b F -r T -c spinner/bench_settings.json -e F +python3 spinner/main.py -b F -r T -c spinner/bench_settings.yaml -e F -python3 spinner/main.py -g T -s 1000000000 -o random_numbers.bin -r T -c spinner/bench_settings.json -e T -h "sdumont[6174-6177]" +python3 spinner/main.py -g T -s 1000000000 -o random_numbers.bin -r T -c spinner/bench_settings.yaml -e T -h "sdumont[6174-6177]" ``` # Mandatory development policy diff --git a/spinner/bench_settings.json b/spinner/bench_settings.json deleted file mode 100644 index b039db9..0000000 --- a/spinner/bench_settings.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "metadata": { - "description": "I/O benchmarks", - "version": "1.0", - "runs": 2, - "timeout": 600, - "input_file": "random_numbers.bin", - "omp-tasks": { - "bench_path": "benchs/omp-tasks", - "env": { - "CC": "gcc", - "CXX": "g++" - }, - "build_instructions": [ - { - "command": "mkdir -p build", - "cwd": "{{bench_path}}" - }, - { - "command": "cmake .. -DCMAKE_BUILD_TYPE=Release", - "cwd": "{{bench_path}}/build" - }, - { - "command": "make -j", - "cwd": "{{bench_path}}/build" - } - ], - "command": { - "template": "{{bench_path}}/build/lustre1 -t {{tasks}} -r {{read_step}} -f {{input_file}}" - } - }, - "mpi-io": { - "bench_path": "benchs/mpi-io", - "env": { - "CC": "mpicc", - "CXX": "mpicxx" - }, - "build_instructions": [ - { - "command": "mkdir -p build", - "cwd": "{{bench_path}}" - }, - { - "command": "cmake .. -DCMAKE_BUILD_TYPE=Release", - "cwd": "{{bench_path}}/build" - }, - { - "command": "make -j", - "cwd": "{{bench_path}}/build" - } - ], - "command": { - "template": "mpirun -np {{procs}} -ppn {{ppn}} -hosts {{hosts}} {{bench_path}}/build/mpi_io_count {{input_file}} {{read_step}}" - } - } - }, - "omp-tasks": { - "tasks": [ - 1, - 2 - ], - "read_step": [ - 100, - 101 - ] - }, - "mpi-io": { - "nodes": [ - 1 - ], - "procs": [ - 1, - 2 - ], - "read_step": [ - 100 - ] - } -} \ No newline at end of file diff --git a/spinner/bench_settings.yaml b/spinner/bench_settings.yaml new file mode 100644 index 0000000..0bbe52b --- /dev/null +++ b/spinner/bench_settings.yaml @@ -0,0 +1,51 @@ +metadata: + description: I/O benchmarks + version: "1.0" + runs: 2 + timeout: 600 + input_file: random_numbers.bin + omp-tasks: + bench_path: benchs/omp-tasks + env: + CC: gcc + CXX: g++ + build_instructions: + - command: mkdir -p build + cwd: "{{bench_path}}" + - command: cmake .. -DCMAKE_BUILD_TYPE=Release + cwd: "{{bench_path}}/build" + - command: make -j + cwd: "{{bench_path}}/build" + command: + template: "{{bench_path}}/build/lustre1 -t {{tasks}} -r {{read_step}} -f {{input_file}}" + mpi-io: + bench_path: benchs/mpi-io + env: + CC: mpicc + CXX: mpicxx + build_instructions: + - command: mkdir -p build + cwd: "{{bench_path}}" + - command: cmake .. -DCMAKE_BUILD_TYPE=Release + cwd: "{{bench_path}}/build" + - command: make -j + cwd: "{{bench_path}}/build" + command: + template: "mpirun -np {{procs}} -ppn {{ppn}} -hosts {{hosts}} {{bench_path}}/build/mpi_io_count {{input_file}} {{read_step}}" + +omp-tasks: + tasks: + - 1 + - 2 + read_step: + - 100 + - 101 + +mpi-io: + nodes: + - 1 + procs: + - 1 + - 2 + read_step: + - 100 diff --git a/spinner/runner/utilities.py b/spinner/runner/utilities.py index 5948172..72b3af6 100644 --- a/spinner/runner/utilities.py +++ b/spinner/runner/utilities.py @@ -7,14 +7,14 @@ from rich.progress import Progress from rich import print as rprint import pandas as pd -import json +import yaml def run_benchmarks(config, hosts): """ Generate execution matrix from input configuration and run all benchmarks. """ - bench_config = json.load(open(config)) + bench_config = yaml.safe_load(open(config)) bench_metadata = bench_config["metadata"] bench_metadata["start_timestamp"] = str(pd.Timestamp.now())