gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers

Scrapes GEOS-Chem Classic benchmark timing information from one or more JSON or text files.

Functions

display_timers(ref, ref_label, dev, ...)

Prints the GEOS-Chem timer information to a table.

make_benchmark_gcclassic_timing_table(...[, ...])

Creates a table of timing information for GEOS-Chem Classic benchmark simulations given one or more JSON and/or text files as input.

print_timer(key, ref, dev, ofile)

Prints timing info for a single timer to a log file.

read_gcclassic(input_files)

Determines whether we should call a function to parse the given input file(s) as JSON or plain text.

read_one_json_file(json_file)

Parses a GEOS-Chem JSON file with timing information and returns a dictionary with the results.

read_one_text_file(text_file)

Parses the GEOS-Chem Classic log file (plain text) with timing information and returns a dictionary with the results.

read_timing_data(input_files, reader)

Parses the GEOS-Chem Classic timing information in JSON format and returns a dictionary with the results.

sum_timers(timers)

Sums the time in seconds for each GEOS-Chem timer.

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.read_gcclassic(input_files)[source]

Determines whether we should call a function to parse the given input file(s) as JSON or plain text.

Parameters:

input_files (str or list) – File or list of files to parse.

Returns:

result – List of dicts with timing info.

Return type:

list of dict

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.read_timing_data(input_files, reader)[source]

Parses the GEOS-Chem Classic timing information in JSON format and returns a dictionary with the results.

Parameters:
  • input_files (str or list) – JSON or text file(s) to parse.

  • reader (function) – Function that will parse the file(s).

Returns:

timing – Dictionary with timing information.

Return type:

list of dict

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.read_one_json_file(json_file)[source]

Parses a GEOS-Chem JSON file with timing information and returns a dictionary with the results.

Parameters:

json_file (str) – JSON file with timing information.

Returns:

result – Dictionary with timing information.

Return type:

dict

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.read_one_text_file(text_file)[source]

Parses the GEOS-Chem Classic log file (plain text) with timing information and returns a dictionary with the results.

Parameters:

text_file (str) – Text file with timing information.

Returns:

result – Dictionary with timing information.

Return type:

dict

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.sum_timers(timers)[source]

Sums the time in seconds for each GEOS-Chem timer. Input may be a single dict with timing information or a list of dicts.

Parameters:

timers (dict or list) – GEOS-Chem timing information from one or more JSON or log files.

Returns:

result – Sum of timing information.

Return type:

dict

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.print_timer(key, ref, dev, ofile)[source]

Prints timing info for a single timer to a log file.

Parameters:
  • key (str) – Dictionary key to print.

  • ref (dict) – Timing information from the “Ref” model.

  • dev (dict) – Timing information from the “Dev” model.

  • ofile (file) – File object where info will be written.

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.display_timers(ref, ref_label, dev, dev_label, table_file)[source]

Prints the GEOS-Chem timer information to a table.

Parameters:
  • ref (dict) – Timing information from the “Ref” model.

  • ref_label (str) – Version string for the “Ref” model.

  • dev (dict) – Timing information from the “Dev” model.

  • dev_label (str) – Version string for the “Dev” model.

  • table_file (str) – File name for the timing table output.

gcpy.benchmark.modules.benchmark_scrape_gcclassic_timers.make_benchmark_gcclassic_timing_table(ref_files, ref_label, dev_files, dev_label, dst='./benchmark', overwrite=False)[source]

Creates a table of timing information for GEOS-Chem Classic benchmark simulations given one or more JSON and/or text files as input.

Parameters:
  • ref_files (str or list) – File(s) with timing info from the “Ref” model.

  • ref_label (str) – Version string for the “Ref” model.

  • dev_files (str or list) – File(s) with timing info from the “Dev” model.

  • dev_label (str) – Version string for the “Dev” model.

  • dst (str, optional) – Directory where output will be written.

  • overwrite (bool, optional) – Overwrite existing files? Default: False.