{"id":13520989,"url":"https://github.com/Capgemini-Invent-France/CarbonAI","last_synced_at":"2025-03-31T20:30:24.522Z","repository":{"id":43147169,"uuid":"412154528","full_name":"Capgemini-Invent-France/CarbonAI","owner":"Capgemini-Invent-France","description":"Python package to monitor the power consumption of any algorithm","archived":false,"fork":false,"pushed_at":"2022-10-17T13:51:06.000Z","size":2055,"stargazers_count":46,"open_issues_count":22,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-14T14:39:02.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Capgemini-Invent-France.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-30T17:12:13.000Z","updated_at":"2024-08-19T10:33:15.000Z","dependencies_parsed_at":"2022-09-07T17:24:25.004Z","dependency_job_id":null,"html_url":"https://github.com/Capgemini-Invent-France/CarbonAI","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capgemini-Invent-France%2FCarbonAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capgemini-Invent-France%2FCarbonAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capgemini-Invent-France%2FCarbonAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capgemini-Invent-France%2FCarbonAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Capgemini-Invent-France","download_url":"https://codeload.github.com/Capgemini-Invent-France/CarbonAI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246535707,"owners_count":20793308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:00:25.627Z","updated_at":"2025-03-31T20:30:24.220Z","avatar_url":"https://github.com/Capgemini-Invent-France.png","language":"Python","funding_links":[],"categories":["🛠 Tools","Tools"],"sub_categories":["Code-Based Tools","Tools for measuring and quantifying footprint"],"readme":"# CarbonAI\n\nThis project aims at creating a python package that allows you to monitor the power consumption of any python function.\n\n## Documentation\n\nThe complete documentation is available [here](https://capgemini-invent-france.github.io/CarbonAI/).\n\n## Getting started\n### Install\n\nFirst of all you need to install the intel utility allowing you to monitor power consumption ([support](https://software.intel.com/en-us/articles/intel-power-gadget)):\n* [Windows](https://software.intel.com/file/823776/download)\n* [MacOS](https://software.intel.com/sites/default/files/managed/91/6b/Intel%20Power%20Gadget.dmg)\n* Linux, no need to install any software\n\nTo install this package :\n```sh\npip install carbonai\n```\n\n### Example\n\nThere are several ways to use this package depending on how you develop.\nYou just have to import the `PowerMeter` object, initialize it and call the function you want to monitor.\nPlease insert a description of the running function, the dataset, the model, any info would be useful.\n\n#### Function decorator\nTo monitor the power consumption of a function, follow this example:\n```python\nfrom carbonai import PowerMeter\npower_meter = PowerMeter(project_name=\"MNIST classifier\")\n\n@power_meter.measure_power(\n  package=\"sklearn\",\n  algorithm=\"RandomForestClassifier\",\n  data_type=\"tabular\",\n  data_shape=\u003cyour_data\u003e.shape,\n  algorithm_params=\"n_estimators=300, max_depth=15\",\n  comments=\"Classifier trained on the MNIST dataset, 3rd test\"\n)\ndef my_func(arg1, arg2, ...):\n  # Do something\n```\n\n#### Using the with statement\nTo monitor the power consumption of some specific inline code, you can use with statements\n\n```python\nfrom carbonai import PowerMeter\npower_meter = PowerMeter(project_name=\"MNIST classifier\")\n\nwith power_meter(\n  package=\"sklearn\",\n  algorithm=\"RandomForestClassifier\",\n  data_type=\"tabular\",\n  data_shape=\u003cyour_data\u003e.shape,\n  algorithm_params=\"n_estimators=300, max_depth=15\",\n  comments=\"Classifier trained on the MNIST dataset, 3rd test\"\n):\n  # Do something\n```\n\n## Contribute\n\nAll contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.\n\nYou can find details on how to contribute in [our guide](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCapgemini-Invent-France%2FCarbonAI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCapgemini-Invent-France%2FCarbonAI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCapgemini-Invent-France%2FCarbonAI/lists"}