Closed accountForIssues closed 4 months ago
Also tried it today with process tracking_mode. Besides the RAM, everything else seems to be similar to the above.
I'm mainly interested in the total emissions and energy used for the entire training (process) duration. The average power/energy will be nice to have but not necessary.
{
"timestamp": "2024-03-31T13:05:42",
"project_name": "finetuning",
"run_id": "965fba31-6c53-4313-a8f4-7028837133de",
"duration": 289.8846218585968,
"emissions": 0.013126898727831899,
"emissions_rate": 0.0000452831841981431,
"cpu_power": 172.58601686518426,
"gpu_power": 16.64991510011033,
"ram_power": 1.6509547233581543,
"cpu_energy": 0.019036346739134652,
"gpu_energy": 0.015457212018537003,
"ram_energy": 0.00011831364604057935,
"energy_consumed": 0.034611872403712225,
"country_name": "United States",
"country_iso_code": "USA",
"region": null,
"cloud_provider": "",
"cloud_region": "",
"os": "Linux-5.19.17-coreweave-x86_64-with-glibc2.35",
"python_version": "3.10.12",
"codecarbon_version": "2.3.4",
"cpu_count": 128,
"cpu_model": "AMD EPYC 7513 32-Core Processor",
"gpu_count": 1,
"gpu_model": "1 x NVIDIA RTX A5000",
"longitude": null,
"latitude": null,
"ram_total_size": 755.4418983459473,
"tracking_mode": "process",
"on_cloud": "N",
"pue": 1.25
}
Complete log:
warnings.warn(
[codecarbon INFO @ 13:00:51] offline tracker init
Starting training
/opt/runtime/lib/python3.10/site-packages/accelerate/accelerator.py:432: FutureWarning: Passing the following arguments to `Accelerator` is deprecated and will be removed in version 1.0 of Accelerate: dict_keys(['dispatch_batches', 'split_batches', 'even_batches', 'use_seedable_sampler']). Please pass an `accelerate.DataLoaderConfiguration` instead:
dataloader_config = DataLoaderConfiguration(dispatch_batches=None, split_batches=False, even_batches=True, use_seedable_sampler=True)
warnings.warn(
[codecarbon INFO @ 13:00:54] [setup] RAM Tracking...
[codecarbon INFO @ 13:00:54] [setup] GPU Tracking...
[codecarbon INFO @ 13:00:54] Tracking Nvidia GPU via pynvml
[codecarbon INFO @ 13:00:54] [setup] CPU Tracking...
[codecarbon INFO @ 13:00:54] Tracking Intel CPU via RAPL interface
[codecarbon INFO @ 13:00:55] >>> Tracker's metadata:
[codecarbon INFO @ 13:00:55] Platform system: Linux-5.19.17-coreweave-x86_64-with-glibc2.35
[codecarbon INFO @ 13:00:55] Python version: 3.10.12
[codecarbon INFO @ 13:00:55] CodeCarbon version: 2.3.4
[codecarbon INFO @ 13:00:55] Available RAM : 755.442 GB
[codecarbon INFO @ 13:00:55] CPU count: 128
[codecarbon INFO @ 13:00:55] CPU model: AMD EPYC 7513 32-Core Processor
[codecarbon INFO @ 13:00:55] GPU count: 1
[codecarbon INFO @ 13:00:55] GPU model: 1 x NVIDIA RTX A5000
[codecarbon INFO @ 13:01:07] Energy consumed for RAM : 0.000004 kWh. RAM Power : 0.7472505569458008 W
[codecarbon INFO @ 13:01:07] Energy consumed for all GPUs : 0.000844 kWh. Total GPU Power : 162.04537887489198 W
[codecarbon INFO @ 13:01:07] Energy consumed for all CPUs : 0.000976 kWh. Total CPU Power : 187.30510374925484 W
[codecarbon INFO @ 13:01:07] 0.001824 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:11] Energy consumed for RAM : 0.001181 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:01:11] Energy consumed for all GPUs : 0.000899 kWh. Total GPU Power : 215.70380513395017 W
[codecarbon INFO @ 13:01:11] Energy consumed for all CPUs : 0.000787 kWh. Total CPU Power : 188.89025180767266 W
[codecarbon INFO @ 13:01:11] 0.002867 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:22] Energy consumed for RAM : 0.000008 kWh. RAM Power : 0.7472877502441406 W
[codecarbon INFO @ 13:01:22] Energy consumed for all GPUs : 0.001988 kWh. Total GPU Power : 219.68553636031692 W
[codecarbon INFO @ 13:01:22] Energy consumed for all CPUs : 0.001951 kWh. Total CPU Power : 187.1676668238832 W
[codecarbon INFO @ 13:01:22] 0.003947 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:26] Energy consumed for RAM : 0.002361 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:01:26] Energy consumed for all GPUs : 0.001816 kWh. Total GPU Power : 219.96875869661432 W
[codecarbon INFO @ 13:01:26] Energy consumed for all CPUs : 0.001556 kWh. Total CPU Power : 184.432795315955 W
[codecarbon INFO @ 13:01:26] 0.005733 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:37] Energy consumed for RAM : 0.000012 kWh. RAM Power : 0.7472977638244629 W
[codecarbon INFO @ 13:01:37] Energy consumed for all GPUs : 0.003135 kWh. Total GPU Power : 220.09618502076347 W
[codecarbon INFO @ 13:01:37] Energy consumed for all CPUs : 0.002945 kWh. Total CPU Power : 190.95824251688984 W
[codecarbon INFO @ 13:01:37] 0.006091 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:41] Energy consumed for RAM : 0.003541 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:01:41] Energy consumed for all GPUs : 0.002732 kWh. Total GPU Power : 219.91277161568922 W
[codecarbon INFO @ 13:01:41] Energy consumed for all CPUs : 0.002351 kWh. Total CPU Power : 190.8530844741656 W
[codecarbon INFO @ 13:01:41] 0.008624 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:52] Energy consumed for RAM : 0.000016 kWh. RAM Power : 0.7472991943359375 W
[codecarbon INFO @ 13:01:52] Energy consumed for all GPUs : 0.004280 kWh. Total GPU Power : 219.96788891210292 W
[codecarbon INFO @ 13:01:52] Energy consumed for all CPUs : 0.003912 kWh. Total CPU Power : 185.58129434690667 W
[codecarbon INFO @ 13:01:52] 0.008208 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:01:56] Energy consumed for RAM : 0.004721 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:01:56] Energy consumed for all GPUs : 0.003649 kWh. Total GPU Power : 220.19293419416147 W
[codecarbon INFO @ 13:01:56] Energy consumed for all CPUs : 0.003128 kWh. Total CPU Power : 186.34422525231454 W
[codecarbon INFO @ 13:01:56] 0.011498 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:07] Energy consumed for RAM : 0.000019 kWh. RAM Power : 0.7472991943359375 W
[codecarbon INFO @ 13:02:07] Energy consumed for all GPUs : 0.005434 kWh. Total GPU Power : 221.63650961124793 W
[codecarbon INFO @ 13:02:07] Energy consumed for all CPUs : 0.004882 kWh. Total CPU Power : 186.37343104811384 W
[codecarbon INFO @ 13:02:07] 0.010336 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:11] Energy consumed for RAM : 0.005902 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:02:11] Energy consumed for all GPUs : 0.004566 kWh. Total GPU Power : 219.99364466007867 W
[codecarbon INFO @ 13:02:11] Energy consumed for all CPUs : 0.003926 kWh. Total CPU Power : 191.61053976239936 W
[codecarbon INFO @ 13:02:11] 0.014393 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:22] Energy consumed for RAM : 0.000023 kWh. RAM Power : 0.7472991943359375 W
[codecarbon INFO @ 13:02:22] Energy consumed for all GPUs : 0.006580 kWh. Total GPU Power : 219.97876046345607 W
[codecarbon INFO @ 13:02:22] Energy consumed for all CPUs : 0.005918 kWh. Total CPU Power : 198.79787631332965 W
[codecarbon INFO @ 13:02:22] 0.012521 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:26] Energy consumed for RAM : 0.007082 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:02:26] Energy consumed for all GPUs : 0.005484 kWh. Total GPU Power : 220.35450828021658 W
[codecarbon INFO @ 13:02:26] Energy consumed for all CPUs : 0.004738 kWh. Total CPU Power : 194.79699729631926 W
[codecarbon INFO @ 13:02:26] 0.017304 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:37] Energy consumed for RAM : 0.000027 kWh. RAM Power : 0.7473006248474121 W
[codecarbon INFO @ 13:02:37] Energy consumed for all GPUs : 0.007727 kWh. Total GPU Power : 220.30764672069915 W
[codecarbon INFO @ 13:02:37] Energy consumed for all CPUs : 0.006911 kWh. Total CPU Power : 190.61095360207042 W
[codecarbon INFO @ 13:02:37] 0.014665 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:41] Energy consumed for RAM : 0.008262 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:02:41] Energy consumed for all GPUs : 0.006401 kWh. Total GPU Power : 220.03266971569874 W
[codecarbon INFO @ 13:02:41] Energy consumed for all CPUs : 0.005536 kWh. Total CPU Power : 191.54620955104147 W
[codecarbon INFO @ 13:02:41] 0.020199 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:52] Energy consumed for RAM : 0.000031 kWh. RAM Power : 0.7473034858703613 W
[codecarbon INFO @ 13:02:52] Energy consumed for all GPUs : 0.008876 kWh. Total GPU Power : 220.45023469092814 W
[codecarbon INFO @ 13:02:52] Energy consumed for all CPUs : 0.007907 kWh. Total CPU Power : 191.29399431133254 W
[codecarbon INFO @ 13:02:52] 0.016814 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:02:56] Energy consumed for RAM : 0.009443 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:02:56] Energy consumed for all GPUs : 0.007319 kWh. Total GPU Power : 220.47335336520013 W
[codecarbon INFO @ 13:02:56] Energy consumed for all CPUs : 0.006316 kWh. Total CPU Power : 187.31836655520834 W
[codecarbon INFO @ 13:02:56] 0.023078 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:07] Energy consumed for RAM : 0.000035 kWh. RAM Power : 0.7473034858703613 W
[codecarbon INFO @ 13:03:07] Energy consumed for all GPUs : 0.010022 kWh. Total GPU Power : 220.19263817540437 W
[codecarbon INFO @ 13:03:07] Energy consumed for all CPUs : 0.008880 kWh. Total CPU Power : 186.72056421455744 W
[codecarbon INFO @ 13:03:07] 0.018937 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:11] Energy consumed for RAM : 0.010623 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:03:11] Energy consumed for all GPUs : 0.008235 kWh. Total GPU Power : 219.70956299804305 W
[codecarbon INFO @ 13:03:11] Energy consumed for all CPUs : 0.007103 kWh. Total CPU Power : 188.6756998997984 W
[codecarbon INFO @ 13:03:11] 0.025960 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:22] Energy consumed for RAM : 0.000039 kWh. RAM Power : 0.7473034858703613 W
[codecarbon INFO @ 13:03:22] Energy consumed for all GPUs : 0.011168 kWh. Total GPU Power : 219.91025199628967 W
[codecarbon INFO @ 13:03:22] Energy consumed for all CPUs : 0.009831 kWh. Total CPU Power : 182.67233940762765 W
[codecarbon INFO @ 13:03:22] 0.021037 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:26] Energy consumed for RAM : 0.011802 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:03:26] Energy consumed for all GPUs : 0.009153 kWh. Total GPU Power : 220.69038322081815 W
[codecarbon INFO @ 13:03:26] Energy consumed for all CPUs : 0.007875 kWh. Total CPU Power : 185.39338430812245 W
[codecarbon INFO @ 13:03:26] 0.028830 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:37] Energy consumed for RAM : 0.000043 kWh. RAM Power : 0.74857234954834 W
[codecarbon INFO @ 13:03:37] Energy consumed for all GPUs : 0.012317 kWh. Total GPU Power : 220.62472577864406 W
[codecarbon INFO @ 13:03:37] Energy consumed for all CPUs : 0.010828 kWh. Total CPU Power : 191.53017824020802 W
[codecarbon INFO @ 13:03:37] 0.023188 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:41] Energy consumed for RAM : 0.012982 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:03:41] Energy consumed for all GPUs : 0.010071 kWh. Total GPU Power : 220.35166275717611 W
[codecarbon INFO @ 13:03:41] Energy consumed for all CPUs : 0.008664 kWh. Total CPU Power : 189.4216319957635 W
[codecarbon INFO @ 13:03:41] 0.031718 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:52] Energy consumed for RAM : 0.000047 kWh. RAM Power : 0.7485051155090332 W
[codecarbon INFO @ 13:03:52] Energy consumed for all GPUs : 0.013464 kWh. Total GPU Power : 220.3341024353972 W
[codecarbon INFO @ 13:03:52] Energy consumed for all CPUs : 0.011807 kWh. Total CPU Power : 187.8630951608062 W
[codecarbon INFO @ 13:03:52] 0.025318 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:03:56] Energy consumed for RAM : 0.014163 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:03:56] Energy consumed for all GPUs : 0.010991 kWh. Total GPU Power : 220.68522910907973 W
[codecarbon INFO @ 13:03:56] Energy consumed for all CPUs : 0.009432 kWh. Total CPU Power : 184.23930973773656 W
[codecarbon INFO @ 13:03:56] 0.034585 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:04:05] Energy consumed for RAM : 0.014877 kWh. RAM Power : 283.2907118797302 W
[codecarbon INFO @ 13:04:05] Energy consumed for all GPUs : 0.011548 kWh. Total GPU Power : 220.89852844422032 W
[codecarbon INFO @ 13:04:05] Energy consumed for all CPUs : 0.009920 kWh. Total CPU Power : 193.70954231999332 W
[codecarbon INFO @ 13:04:05] 0.036345 kWh of electricity used since the beginning.
/opt/runtime/lib/python3.10/site-packages/codecarbon/output.py:168: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
df = pd.concat([df, pd.DataFrame.from_records([dict(data.values)])])
[codecarbon INFO @ 13:04:07] Energy consumed for RAM : 0.000051 kWh. RAM Power : 0.7462048530578613 W
[codecarbon INFO @ 13:04:07] Energy consumed for all GPUs : 0.014553 kWh. Total GPU Power : 209.16505605331326 W
[codecarbon INFO @ 13:04:07] Energy consumed for all CPUs : 0.012783 kWh. Total CPU Power : 187.30186791343655 W
[codecarbon INFO @ 13:04:07] 0.027387 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:04:22] Energy consumed for RAM : 0.000057 kWh. RAM Power : 1.2548003196716309 W
[codecarbon INFO @ 13:04:22] Energy consumed for all GPUs : 0.014896 kWh. Total GPU Power : 65.63594918902683 W
[codecarbon INFO @ 13:04:22] Energy consumed for all CPUs : 0.013801 kWh. Total CPU Power : 195.25563044500802 W
[codecarbon INFO @ 13:04:22] 0.028753 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:04:37] Energy consumed for RAM : 0.000064 kWh. RAM Power : 1.2580332756042483 W
[codecarbon INFO @ 13:04:37] Energy consumed for all GPUs : 0.015019 kWh. Total GPU Power : 23.65649601202967 W
[codecarbon INFO @ 13:04:37] Energy consumed for all CPUs : 0.014796 kWh. Total CPU Power : 189.7860203271394 W
[codecarbon INFO @ 13:04:37] 0.029878 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:04:54] Energy consumed for RAM : 0.000073 kWh. RAM Power : 1.5729517936706543 W
[codecarbon INFO @ 13:04:54] Energy consumed for all GPUs : 0.015161 kWh. Total GPU Power : 23.752753694724493 W
[codecarbon INFO @ 13:04:54] Energy consumed for all CPUs : 0.015913 kWh. Total CPU Power : 186.81443076718745 W
[codecarbon INFO @ 13:04:54] 0.031147 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:05:09] Energy consumed for RAM : 0.000087 kWh. RAM Power : 2.7783265113830566 W
[codecarbon INFO @ 13:05:09] Energy consumed for all GPUs : 0.015257 kWh. Total GPU Power : 18.331170484957525 W
[codecarbon INFO @ 13:05:09] Energy consumed for all CPUs : 0.016889 kWh. Total CPU Power : 185.26499250280602 W
[codecarbon INFO @ 13:05:09] 0.032234 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:05:25] Energy consumed for RAM : 0.000108 kWh. RAM Power : 3.921996116638184 W
[codecarbon INFO @ 13:05:25] Energy consumed for all GPUs : 0.015356 kWh. Total GPU Power : 17.928908913098713 W
[codecarbon INFO @ 13:05:25] Energy consumed for all CPUs : 0.017953 kWh. Total CPU Power : 193.35531902638104 W
[codecarbon INFO @ 13:05:25] 0.033417 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:05:41] Energy consumed for RAM : 0.000118 kWh. RAM Power : 1.9352631568908691 W
[codecarbon INFO @ 13:05:41] Energy consumed for all GPUs : 0.015451 kWh. Total GPU Power : 17.816804237108826 W
[codecarbon INFO @ 13:05:41] Energy consumed for all CPUs : 0.018970 kWh. Total CPU Power : 191.06551666798623 W
[codecarbon INFO @ 13:05:41] 0.034538 kWh of electricity used since the beginning.
[codecarbon INFO @ 13:05:42] Energy consumed for RAM : 0.000118 kWh. RAM Power : 1.6509547233581543 W
[codecarbon INFO @ 13:05:42] Energy consumed for all GPUs : 0.015457 kWh. Total GPU Power : 16.64991510011033 W
[codecarbon INFO @ 13:05:42] Energy consumed for all CPUs : 0.019036 kWh. Total CPU Power : 172.58601686518426 W
[codecarbon INFO @ 13:05:42] 0.034612 kWh of electricity used since the beginning.
Hello, can you provide a little more details about why you think the results are incorrect ?
Am I incorrect in thinking that the final_emissions is the average or the overall stats ?
Yes that seems incorrect, the final emissions are computed from the sum of the consumption that you get for every interval if you measure every 1 min for 10 minutes and you get around 0.02kWh each minutes then the average is 0.02kWh, but the total is 10*0.02 = 0.2kWh
As you can see in the log Available RAM : 755.442 GB
so we use this size for the estimation.
Same for the CPU, it is a 32 code AMD EPYC 7513 32-Core Processor
so we monitor all of them.
What could help you is to use the code from https://github.com/mlco2/codecarbon/pull/316 than allows to monitor only the process that launch CodeCarbon.
I'm closing this PR, don't hesitate to re-open if you need more information.
Description
I have docker images that are used to train small ML models. These images are used to spin up containers on services such as Coreweave who use K8s for the same. I recently came to know about and added codecarbon to calculate the total resource usage. An example output (offline) is below:
The container is limited to 4x CPU, 16 GB RAM, 1x GPU. I am aware that CPU/RAM counts/sizes can be reflective of the entire system (esp. on Linux) so I'm not concerned about that.
What I am wondering is if the accuracy of the power usage of the different components and the emissions is affected because of the same ?
e.g., Looking up on Google, the CPU above has a TDP of 200W. So, for using 4 cores, 188W seems a lot. Similar with RAM, 283W for 16GB RAM.
Though, GPU stats seems to be correct.And the GPU power usage seems to be incorrect. In the actual logs, it updated correctly with the actual usage but in the final emissions, it seems to wrong.Am I incorrect in thinking that the final_emissions is the average or the overall stats ?
Is there anything I can do to "correct" this ? If not, can I use those numbers and calculate the right values ?
The complete log: