Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions documentation/Sphinx/user_guide/output/post-processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ script, these are given in the table below.
* - ``-i/ --input_name``
- vernier-output-
- Vernier files to read from
* - ``-d/ --decimals``
- 3
- Number of decimal places to report calculated values to
* - ``-m/ --max_only``
- False
- If used will only calculate maximum values across MPI ranks
Expand All @@ -59,6 +62,7 @@ script, these are given in the table below.

Below is an example of the current script output without additional flags.


.. code-block:: text

Routine Mean_Total Min_Total Max_Total Mean_Self Min_Self Max_Self
Expand Down
10 changes: 9 additions & 1 deletion post-processing/post-process.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def parse_cli_arguments(input_arguments: list[str] = None,
"""

parser = argparse.ArgumentParser(description="This script is for merging the outputs from a test that uses Vernier callipers into one file. For full documentation please see the post-processing section of the user guide.")

parser.add_argument("-p", "--path", type=Path, default=(os.getcwd()), help="Path to Vernier output files")
parser.add_argument("-o", "--output_name", type=str, default=str("vernier-merged-output"), help="Name of file to write to")
parser.add_argument("-i", "--input_name", type=str, default=str("vernier-output-"), help="Vernier files to read from")
parser.add_argument("-m", "--max_only", action="store_true", default=False, help="Only calculates the maximum value across all ranks")
parser.add_argument("-f", "--full_info", action="store_true", default=False, help="Enables merging and displaying of all information Vernier records")
parser.add_argument("-d", "--decimals", type=int, default=3, help="Number of decimal places calculated results will be reported to")

return parser.parse_args(args=input_arguments)

Expand Down Expand Up @@ -193,8 +195,14 @@ def main():
input_name = args.input_name
max_only_bool = args.max_only
full_info_bool = args.full_info
decimals = args.decimals

mpiranks = read_mpi_ranks(file_path, input_name)

if decimals >= 4:

print("WARNING: Vernier typically reports values to 3 d.p, so calculated values may not be accurate or representative at higher precisions and may not display correctly")

if mpiranks == 0:

print("Error, no vernier-outputs detected")
Expand All @@ -209,7 +217,7 @@ def main():

thread_string = "@0"
merged_frame["Routine"] = merged_frame["Routine"].str.replace(thread_string, '')

merged_frame = merged_frame.round(decimals)
print("\nWriting...")
with open(f"{merged_file_name}", 'w') as f:
f.write(merged_frame.to_string(index=False, col_space=10))
Expand Down