Skip to content

Commit

Permalink
Measure energy usage instead of emissions (fitbenchmarking#1377)
Browse files Browse the repository at this point in the history
* switch from emissions to energy usage

* remove local changes

* Discard changes to .gitignore

* Update fitbenchmarking/core/results_output.py

Co-authored-by: RabiyaF <[email protected]>

* Update fitbenchmarking/utils/fitbm_result.py

Co-authored-by: RabiyaF <[email protected]>

* Add units

Co-authored-by: RabiyaF <[email protected]>

* rename docs page

* line length fix

* Reduce interval for measuring power usage

Co-authored-by: RabiyaF <[email protected]>

* ruff format fix

---------

Co-authored-by: RabiyaF <[email protected]>
  • Loading branch information
jess-farmer and RabiyaF authored Nov 18, 2024
1 parent 5b1cdc6 commit 67510c6
Show file tree
Hide file tree
Showing 32 changed files with 225 additions and 214 deletions.
6 changes: 3 additions & 3 deletions docs/source/users/options/output_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ Options are:
The value of :math:`\frac{|| J^T r||}{||r||}` for those parameters is also returned.
The output looks like ``{bool} (norm_value)``, and the colouring is red for false and cream for true.
This option is only meaningful for least-squares cost functions.
* ``emissions`` indicates that the resulting table should contain the CO\ :sub:`2` \ emissions for each of the minimizers.
* ``energy_usage`` indicates that the resulting table should contain energy consumption (kWh) for each of the minimizers.

Default is ``acc``, ``runtime``, ``compare``, ``local_min``, and ``emissions``.
Default is ``acc``, ``runtime``, ``compare``, ``local_min``, and ``energy_usage``.

.. code-block:: rst
Expand All @@ -141,7 +141,7 @@ Default is ``acc``, ``runtime``, ``compare``, ``local_min``, and ``emissions``.
runtime
compare
local_min
emissions
energy_usage
Run Dash (:code:`run_dash`)
-------------------------------
Expand Down
9 changes: 0 additions & 9 deletions docs/source/users/output/emissions.rst

This file was deleted.

9 changes: 9 additions & 0 deletions docs/source/users/output/energy_usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _energy_usage:

##################
Energy Usage Table
##################

.. currentmodule:: fitbenchmarking.results_processing.energy_usage_table
.. autoclass:: fitbenchmarking.results_processing.energy_usage_table.EnergyUsageTable
:noindex:
4 changes: 2 additions & 2 deletions docs/source/users/output/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Tables
acc
runtime
local_min
emissions
energy_usage

Display modes
-------------

The tables for ``accuracy``, ``runtime``, ``emissions``, and ``compare`` have three display
The tables for ``accuracy``, ``runtime``, ``energy_usage``, and ``compare`` have three display
modes:

.. prettyprintmodulevalue::
Expand Down
6 changes: 3 additions & 3 deletions fitbenchmarking/cli/checkpoint_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ def get_parser() -> ArgumentParser:
"--strategy",
metavar="STRATEGY",
default="first",
choices=["first", "last", "accuracy", "runtime", "emissions"],
choices=["first", "last", "accuracy", "runtime", "energy"],
help=(
"The merge strategy to use when dealing with conflicts. "
"Selecting accuracy, emissions, or runtime will select for the "
"Selecting accuracy, energy, or runtime will select for the "
"lowest from conflicting runs."
),
)
Expand Down Expand Up @@ -381,7 +381,7 @@ def key_gen(k: dict):
key = key_gen(res)
if key in A_key:
if (
strategy in ["accuracy", "emissions", "runtime"]
strategy in ["accuracy", "energy", "runtime"]
and A[A_key[key]][strategy] > res[strategy]
):
A[A_key[key]] = res
Expand Down
2 changes: 1 addition & 1 deletion fitbenchmarking/cli/tests/test_checkpoint_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_strategy(self):
"result": 0.1,
},
{
"strategy": "emissions",
"strategy": "energy",
"result": 12.0,
},
]
Expand Down
12 changes: 6 additions & 6 deletions fitbenchmarking/cli/tests/test_files/A.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.1,
"emissions": 1.9,
"energy": 1.9,
"runtime": 0.2,
"flag": 0,
"software": "common1",
Expand All @@ -78,7 +78,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.1,
"emissions": 1.8,
"energy": 1.8,
"runtime": 0.2,
"flag": 0,
"software": "common1",
Expand All @@ -100,7 +100,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.7,
"energy": 1.7,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -122,7 +122,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.6,
"energy": 1.6,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -144,7 +144,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.5,
"energy": 1.5,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -166,7 +166,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.4,
"energy": 1.4,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand Down
20 changes: 10 additions & 10 deletions fitbenchmarking/cli/tests/test_files/AB.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.1,
"emissions": 1.9,
"energy": 1.9,
"runtime": 0.2,
"flag": 0,
"software": "common1",
Expand All @@ -94,7 +94,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.1,
"emissions": 1.8,
"energy": 1.8,
"runtime": 0.2,
"flag": 0,
"software": "common1",
Expand All @@ -116,7 +116,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.7,
"energy": 1.7,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -138,7 +138,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.6,
"energy": 1.6,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -160,7 +160,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.5,
"energy": 1.5,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -182,7 +182,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 1.4,
"energy": 1.4,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -204,7 +204,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.7,
"energy": 0.7,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -226,7 +226,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.6,
"energy": 0.6,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand All @@ -248,7 +248,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.5,
"energy": 0.5,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand All @@ -270,7 +270,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.4,
"energy": 0.4,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand Down
12 changes: 6 additions & 6 deletions fitbenchmarking/cli/tests/test_files/B.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 12.0,
"emissions": 0.9,
"energy": 0.9,
"runtime": 30.0,
"flag": 0,
"software": "common1",
Expand All @@ -78,7 +78,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 12.0,
"emissions": 0.8,
"energy": 0.8,
"runtime": 30.0,
"flag": 0,
"software": "common1",
Expand All @@ -100,7 +100,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.7,
"energy": 0.7,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -122,7 +122,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.6,
"energy": 0.6,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand All @@ -144,7 +144,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.5,
"energy": 0.5,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand All @@ -166,7 +166,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 0.4,
"energy": 0.4,
"runtime": 0.0,
"flag": 0,
"software": "B1",
Expand Down
12 changes: 6 additions & 6 deletions fitbenchmarking/cli/tests/test_files/C.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -78,7 +78,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -100,7 +100,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -122,7 +122,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -144,7 +144,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand All @@ -166,7 +166,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand Down
4 changes: 2 additions & 2 deletions fitbenchmarking/cli/tests/test_files/D.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "common1",
Expand All @@ -46,7 +46,7 @@
"fin_params": "",
"fin_params_str": "",
"accuracy": 0.0,
"emissions": 2.9,
"energy": 2.9,
"runtime": 0.0,
"flag": 0,
"software": "A1",
Expand Down
Loading

0 comments on commit 67510c6

Please sign in to comment.