-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve logging and carbon tracking consistency (#371)
* Raise error if tracking not set up * Add troubleshooting for carbon tracking * Ensure track_carbon flag set correctly * Pass tracking flag to sub-calculations * Allow extra kwargs to be passed to carbon tracker * Set attach_logger correctly * Refactor setting log and tracker defaults
- Loading branch information
1 parent
bf53f87
commit 1d79227
Showing
14 changed files
with
254 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ User guide | |
|
||
command_line | ||
python | ||
troubleshooting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
=============== | ||
Troubleshooting | ||
=============== | ||
|
||
Carbon tracking | ||
--------------- | ||
|
||
Enabling tracking (Python) | ||
++++++++++++++++++++++++++ | ||
|
||
Carbon tracking can be enabled through the ``track_carbon`` option. | ||
By default, this is ``True`` if logging is enabled, but requires setting ``attach_logger``, as this defaults to ``False``. | ||
|
||
For example, to track the carbon emissions during a single point calculation: | ||
|
||
.. code-block:: python | ||
from janus_core.calculations.single_point import SinglePoint | ||
sp = SinglePoint( | ||
struct_path="tests/data/NaCl.cif", | ||
attach_logger=True, | ||
track_carbon=True, | ||
) | ||
This generates a log file, ``NaCl-singlepoint-log.yml``, which stores the emissions for the calculation. | ||
|
||
|
||
In the case of multiple calculations, such as geometry optimisation triggered during molecular dynamics, | ||
the emissions for each component of the calculation will be separate items in the log. | ||
|
||
|
||
Disabling tracking (CLI) | ||
++++++++++++++++++++++++ | ||
|
||
Currently, carbon tracking is enabled by default when using the command line interface, | ||
saving the total calculating emissions to the generated summary file, as well as additional details and | ||
per-calculation emissions to the log file. | ||
|
||
This can be disabled by passing the ``--no-tracker`` flag to any command. For example: | ||
|
||
.. code-block:: bash | ||
janus singlepoint --struct tests/data/NaCl.cif --no-tracker | ||
Sudo access | ||
+++++++++++ | ||
|
||
On some systems, such as MacOS, the carbon tracker may prompt for your password, if you have sudo access. | ||
To avoid this, you can: | ||
|
||
1. Disable carbon tracking, as described in `Disabling tracking (CLI)`_. | ||
3. Modify your sudoers file, as described `here <https://mlco2.github.io/codecarbon/methodology.html#cpu>`_, to provide sudo rights for all future calculations. | ||
2. Provide your password. This may be saved for a period of time, but will need to be entered again in future. | ||
4. Fail authentication, for example by entering an invalid or no password three times, which triggers the tracking to default to a constant power. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.