carbontracker relies on APIs to query real-time local carbon intensities in the region in which you are training. These APIs are implemented in carbontracker as a fetcher.
We use geocoder to fetch information based on the IP of the hardware executing the workload. The information retrieved from geocoder.ip("me")
is supplied to the fetcher in the g_location
object. More information about the geocoder is available here.
If you wish to add your own fetcher
to retrieve accurate carbon emissions from your region then you can do so by implementing an API through these simple steps:
- Find an API which contains the carbon intensity values for your region. (Example: https://carbonintensity.org.uk/)
- Add a new
fetcher
to the existing folder. - Inherit the fetcher abstract class and implement the functions.
- Add the class constructor to the list of working APIs in
intensity.py
file. This is thefetchers
list found in thecarbon_intensity
function.
The current available fetchers
can be found here and can serve as examples on how to implement a fetcher
.
Help improve carbontracker and create a pull request with your working APIs!
It is also possible to add new component frameworks for measuring energy usage. In the base version of carbontracker NVIDIA GPUs and Intel CPUs are supported. Adding more is possible by inheriting handler
.
Work in progress