Skip to content

Commit dccf968

Browse files
committed
Added python and numpy version tags
1 parent d169dc8 commit dccf968

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

fitbenchmarking/cli/checkpoint_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def generate_report(options_file="", additional_options=None, debug=False):
153153
)
154154

155155
checkpoint = Checkpoint(options=options)
156-
results, unselected_minimizers, failed_problems = checkpoint.load()
156+
results, unselected_minimizers, failed_problems, config = checkpoint.load()
157157

158158
all_dirs = []
159159
pp_dfs_all_prob_sets = {}
@@ -164,6 +164,7 @@ def generate_report(options_file="", additional_options=None, debug=False):
164164
options=options,
165165
failed_problems=failed_problems[label],
166166
unselected_minimizers=unselected_minimizers[label],
167+
config=config,
167168
)
168169

169170
pp_dfs_all_prob_sets[label] = pp_dfs

fitbenchmarking/cli/main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import sys
1313
from tempfile import NamedTemporaryFile
1414

15+
import numpy as np
16+
1517
import fitbenchmarking
1618
from fitbenchmarking.cli.checkpoint_handler import generate_report
1719
from fitbenchmarking.cli.exception_handler import exception_handler
@@ -382,6 +384,14 @@ def run(problem_sets, additional_options=None, options_file="", debug=False):
382384
group_labels = []
383385
result_dir = []
384386
pp_dfs_all_prob_sets = {}
387+
config = {
388+
"python_version": (
389+
f"{sys.version_info.major}."
390+
f"{sys.version_info.minor}."
391+
f"{sys.version_info.micro}"
392+
),
393+
"numpy_version": np.__version__,
394+
}
385395
cp = Checkpoint(options=options)
386396

387397
for sub_dir in problem_sets:
@@ -441,6 +451,7 @@ def run(problem_sets, additional_options=None, options_file="", debug=False):
441451
options=options,
442452
failed_problems=failed_problems,
443453
unselected_minimizers=unselected_minimizers,
454+
config=config,
444455
)
445456

446457
pp_dfs_all_prob_sets[label] = pp_dfs

fitbenchmarking/core/results_output.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@
4545

4646
@write_file
4747
def save_results(
48-
options, results, group_name, failed_problems, unselected_minimizers
48+
options,
49+
results,
50+
group_name,
51+
failed_problems,
52+
unselected_minimizers,
53+
config,
4954
):
5055
"""
5156
Create all results files and store them.
@@ -61,8 +66,10 @@ def save_results(
6166
html output
6267
:type failed_problems: list
6368
:params unselected_minimizers: Dictionary containing unselected minimizers
64-
based on the algorithm_type option
69+
based on the algorithm_type option
6570
:type unselected_minimizers: dict
71+
:params config: Dictionary containing env config
72+
:type config: dict
6673
6774
:return: Path to directory of group results, data for building the
6875
performance profile plots
@@ -102,6 +109,7 @@ def save_results(
102109
pp_locations=pp_locations,
103110
failed_problems=failed_problems,
104111
unselected_minimzers=unselected_minimizers,
112+
config=config,
105113
)
106114

107115
create_problem_level_index(

fitbenchmarking/results_processing/tables.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def create_results_tables(
4343
pp_locations,
4444
failed_problems,
4545
unselected_minimzers,
46+
config,
4647
):
4748
"""
4849
Saves the results of the fitting to html/csv tables.
@@ -66,6 +67,8 @@ def create_results_tables(
6667
:params unselected_minimzers: Dictionary containing unselected minimizers
6768
based on the algorithm_type option
6869
:type unselected_minimzers: dict
70+
:params config: Dictionary containing env config.
71+
:type config: dict
6972
7073
:return: filepaths to each table
7174
e.g {'acc': <acc-table-filename>, 'runtime': ...}
@@ -108,6 +111,13 @@ def create_results_tables(
108111
options.runtime_metric
109112
)
110113

114+
config_str = (
115+
"\nThe results were generated using python"
116+
f" {config['python_version']} and numpy "
117+
f"{config['numpy_version']}."
118+
)
119+
description[suffix] = description[suffix] + config_str
120+
111121
root = os.path.dirname(getfile(fitbenchmarking))
112122
template_dir = os.path.join(root, "templates")
113123

fitbenchmarking/utils/checkpoint.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import json
88
import os
99
import pickle
10+
import sys
1011
from base64 import a85decode, a85encode
1112
from tempfile import TemporaryDirectory
1213
from typing import Dict
1314

15+
import numpy as np
16+
1417
from fitbenchmarking.utils.exceptions import CheckpointError
1518
from fitbenchmarking.utils.fitbm_result import FittingResult
1619
from fitbenchmarking.utils.options import Options
@@ -198,6 +201,14 @@ def finalise_group(
198201
{
199202
"failed_problems": failed_problems,
200203
"unselected_minimizers": unselected_minimizers,
204+
"config": {
205+
"python_version": (
206+
f"{sys.version_info.major}."
207+
f"{sys.version_info.minor}."
208+
f"{sys.version_info.micro}"
209+
),
210+
"numpy_version": np.__version__,
211+
},
201212
},
202213
indent=4,
203214
)[6:-1]
@@ -266,6 +277,7 @@ def load(self):
266277
results = group["results"]
267278
unselected_minimizers[label] = group["unselected_minimizers"]
268279
failed_problems[label] = group["failed_problems"]
280+
config = group["config"]
269281

270282
# Unpickle problems so that we use 1 shared object for all results
271283
# per array
@@ -323,7 +335,7 @@ def load(self):
323335

324336
output[label].append(new_result)
325337

326-
return output, unselected_minimizers, failed_problems
338+
return output, unselected_minimizers, failed_problems, config
327339

328340

329341
def _compress(value):

0 commit comments

Comments
 (0)