💻 🧠 Contact school.brainhack@gmail.com for questions! 🧠 💻

Green computing for neuroimaging

Green computing for neuroimaging

"Neuroimaging is an energy-demanding field - from data collection to machine learning analyses to large-scale data storage. This module introduces strategies to evaluate and implement more sustainable neuroimaging pipelines, and encourages trainees to consider the environmental aspects related to scientific activities. The environmental impact of AI will be discussed, covering both its usage as a tool (e.g., generative assistant), and its NeuroAI specific applications (i.e., data analysis)."

Information

The estimated time to complete this training module is 3h.

The prerequisites to take this module are:

Recommended but not mandatory:

If you have any questions regarding the module content please ask them in the relevant module channel on the school Discord server. If you do not have access to the server and would like to join, please send us an email at school [dot] brainhack [at] gmail [dot] com.

Follow up with your local TA(s) to validate you completed the exercises correctly.

Resources

Coming soon!

Exercise

Exercise 1

Estimate the energy consumption and the carbon footprint generated by the analyses described in the following paper using the Green Algorithms calculator:

Use the template provided in the github repository to fill the relevant information, and add the corresponding output from Green Algorithms.

Exercise 2

Calculate the total energy and carbon emissions for the jobs listed in the Slurm log file in the Github repository using the formula given below. You may write a python script from scratch or complete the jupyter notebook provided in the Github repository. The definition of the variables needed is provided in the glossary below. Do not forget to pay attention to the units of each variable.

Equations

(1) CPU energy (Wh) = CPU time (hours) x TDP / number of CPU cores

(2) RAM energy (Wh) = Max Memory x VMC x Runtime (hours)

(3) Total energy (kWh) = ((CPU energy + RAM energy) / 1000) x PUE

(4) Carbon emissions (g) = Total energy x VMC x Carbon intensity

Glossary

Carbon emissions (g): quantity of carbon emitted to execute a job.

Carbon intensity (g): Grams of carbon dioxide emitted per KWh used. It varies by time and location.

  • Value: assume a value of 177g (average for the UK in 2025)
  • Where to find: In general, the online carbon intensity value can be retrieved from Electricity Maps

CPU energy: Electrical energy used by the Central Processing Units (CPUs) while executing a job.

  • Value: computed using the formula above

CPU time: Total time all CPU cores actually worked on a given task.

  • Value: provided in the log file under the TotalCPU column

Number of CPU cores: Available number of CPU cores on a given processor.

  • Value: assume a value of 32

Max memory: Maximum memory (GB) used at any point within a job.

  • Value: provided in the log file under the MaxRSS column

Power use effectiveness (PUE): Energy overheads used to performed computing.

  • Value: assume a value of 1.28KWh. This means for each KWh used for computing, 0.28 kWh were used for air conditioning, lighting, etc.

RAM energy: Energy used by the volatile memory of the system (Random Access Memory; RAM), which allows to store and retrieve data during a job’s execution.

  • Value: computed using the formula above

Runtime: Total time needed for a job to finish running.

  • Value: provided in the log file under the Elapsed column

Thermal design power (TDP): Energy efficiency of a processor.

  • Value: 200W for the processor used here (AMD EPYC 7513)

Total energy: Sum of all electrical consumption required to execute the job.

  • Value: computed using the formula above

Volatile memory consumption (VMC): Energy (W) needed per GB of memory used.

  • Value: assume a value of 0.3725W

Bonus

Using the code provided in the main-educational tutorial “Introduction to brain decoding in fMRI”, calculate and compare the carbon footprint of the three decoding models (SVM, MLP, GCN). For this exercise, you will have to integrate codecarbon in your script.

To go even further, try plotting the energy usage and the model accuracy curves for different sample size (i.e., different number of observations).