Skip to content

0.3.13

Latest

Choose a tag to compare

@alexnkorovin alexnkorovin released this 03 Nov 07:49

Measurement

  • Measure CPU from the RAPL package energy counter when it is present, and ignore DRAM energy. Otherwise keep the TDP estimate. Record which path was used.
  • Measure RAM from the process tree RSS instead of scanning every process on the machine.
  • Measure NVIDIA energy from the NVML total-energy counter. The first read is a baseline and adds nothing. If the counter cannot be read, use power times the duration since the previous sample. A negative result is stored as zero. Shut the GPU down when the run ends.
  • Ignore energy from an idle NVIDIA card. It is not part of a CPU-only calculation.
  • Count NVIDIA energy only for devices where this process tree has a compute or graphics context, on both the energy-counter path and the power-times-duration path. No context records zero and nvml_not_used. If the process list cannot be read, count every device. Device names and the device count still describe every visible device.
  • Read accelerators from the driver already on the machine. No vendor Python package is imported. NVIDIA uses the driver NVML library, with nvidia-smi as a power fallback. AMD uses rocm-smi or amd-smi, Intel discrete GPUs use xpu-smi, Huawei Ascend uses npu-smi, and Google TPU uses tpu-info. An Intel integrated GPU is skipped when a RAPL package is present, so it is not counted again as CPU energy.
  • Keep the method label in CPU_name and GPU_name (method:tdp, method:rapl, method:nvml_energy, method:nvml_power, method:nvml_not_used). Optional columns CPU_consumption(kWh), GPU_consumption(kWh), and RAM_consumption(kWh) are written only when device_consumption is set. They are appended, so an older emission file stays readable with the option on or off. Missing values in older rows are N/A.
  • Add the newer CPU TDP rows. On macOS, keep a successful hw.packages count instead of replacing it with 1. number_of_cpu reports a failure instead of hiding a successful read.
  • Cache the CPU socket count in the settings config.json. The first lookup probes once and stores cpu_sockets. Windows counts processor packages with GetLogicalProcessorInformationEx. Linux counts distinct physical package ids. macOS reads hw.packages. Tracker(cpu_sockets=...) uses that count for one run and does not rewrite the file.

Carbon

  • Replace regional intensities and cite the sources in SOURCES.md. The World row is the Ember 2025 average, 458.490 kg/MWh. Country rows stay Ember. Regional rows use ember-india (India, 2024), egrid2023 (US states and the District of Columbia), nga2025 (Australia, CO2e), nir2024 (Canada, CO2e), mee2023 (China), mcti2025 (Brazil SIN), moej2026 (Japan), and the 2021 factors kept for Russian regions (russia) and for Albania and the US Virgin Islands (ger2022). Each territory's alternative name is one local name.
  • Store year and reference on every carbon_index.csv row, before Emission intensity, kg/MWh. Intensity is read by that column name.
  • Add report columns eco2ai_version, cpu_power_method, gpu_power_method, carbon_year, carbon_source, and carbon_basis. Year and source are copied from the matched row. Basis is CO2e for nga2025 and nir2024, and CO2 for every other reference. A user emission_level has year N/A and source and basis user. Older rows in an existing file get N/A in the new columns. define_carbon_index still returns only the intensity and the label.
  • Resolve an omitted country without requiring the network. The order is the ECO2AI_ALPHA2 environment variable, one request to ipinfo with a 3 second timeout, the country and region in the settings config.json, then the World row. An old location.json is copied into that file once and removed. An explicit country code does not use the network or the cache.

Tracking

  • Store tracker defaults, country, region, and cpu_sockets in the settings config.json. With no settings_dir, that file is ~/.eco2ai/config.json. A worktree .eco2ai/config.json can set settings_dir, and that directory's config.json is used instead. Constructing a Tracker reads those defaults and does not create the file. set_params writes the defaults. An old config.txt is read until the next write, which stores config.json and deletes the text file. An old hardware.json is copied into cpu_sockets once and removed. The shipped data/config.txt template is not read at runtime.
  • eco2ai with no arguments prints the settings folder and the results folder. eco2ai --settings-dir and eco2ai --results-dir store those paths in ./.eco2ai/config.json and then print both. A relative file_name is joined to results_dir. An absolute file_name is used as given. project_name, experiment_description, and file_name stay Tracker arguments.
  • Write the open training interval when tracking stops. A training run that never calls new_epoch still records one row. A later sample that adds no energy does not add another row. stop() in a normal run writes the row once, including the encoded file. Calling stop() again after shutdown returns. Calling it before start() still raises.
  • Use Tracker as a context manager. Entering the block starts it. Leaving the block stops it, including when the block raises, and the original exception propagates.
  • https://github.com/track and https://github.com/track(project_name=..., file_name=...) stop once, in finally. Tracker keywords are not passed to the wrapped function. The wrapped exception propagates.
  • Pass callback to receive each written row as a dict of column name to value. Eco2AICallback, imported from eco2ai.lightning, starts training when a Lightning fit starts, records the logged metrics at the end of each training epoch, and stops when the fit ends. import eco2ai does not load Lightning. If Lightning is missing, importing eco2ai.lightning raises ImportError and names pip install lightning.

Dependencies

  • Bound the install for current Python and pandas, including pandas 3. Package data opens without pkg_resources on Python 3.9 and newer. GPU names accept both bytes and str. The pandas 3 removal of is_categorical_dtype has a fallback. pynvml is not a required dependency.

What's Changed

New Contributors

Full Changelog: 0.3.12...0.3.13