{"id":21168427,"url":"https://github.com/anaconda/intel-green-ai","last_synced_at":"2026-02-05T22:32:04.911Z","repository":{"id":116438742,"uuid":"602706021","full_name":"anaconda/intel-green-ai","owner":"anaconda","description":"Code and Experimental Package attached to the article \"Greener Machine Learning Computing with Intel AI Acceleration\"","archived":false,"fork":false,"pushed_at":"2024-08-14T02:46:52.000Z","size":244,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-22T13:43:20.553Z","etag":null,"topics":["anaconda","anaconda-environment","green-ai","machine-learning","machine-learning-benchmarks","scikit-learn","scikit-learn-benchmarks"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anaconda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-16T19:19:11.000Z","updated_at":"2024-02-02T17:03:30.000Z","dependencies_parsed_at":"2025-06-07T08:14:18.893Z","dependency_job_id":null,"html_url":"https://github.com/anaconda/intel-green-ai","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anaconda/intel-green-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anaconda%2Fintel-green-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anaconda%2Fintel-green-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anaconda%2Fintel-green-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anaconda%2Fintel-green-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anaconda","download_url":"https://codeload.github.com/anaconda/intel-green-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anaconda%2Fintel-green-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29136769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T21:59:57.939Z","status":"ssl_error","status_checked_at":"2026-02-05T21:59:57.628Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["anaconda","anaconda-environment","green-ai","machine-learning","machine-learning-benchmarks","scikit-learn","scikit-learn-benchmarks"],"created_at":"2024-11-20T15:13:15.238Z","updated_at":"2026-02-05T22:32:04.887Z","avatar_url":"https://github.com/anaconda.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Greener Machine Learning Computing with Intel AI Acceleration\n\nThis repository contains the experimental package attached to the article \"Greener Machine Learning Computing with Intel AI Acceleration\"\n\nThis documents provides detailed instructions on how to replicate the experimental settings used to measure the **energy consumption** of Machine Learning pipelines as defined in the [IntelPython/Machine Learning Benchmark](https://github.com/IntelPython/scikit-learn_bench).\n\nThese experiments compare the performance of stock (i.e. non-optimized) `scikit-learn` algorithms with the corresponding Intel-accelerated ones included in [`scikit-learn-intelex`](https://intel.github.io/scikit-learn-intelex/), the free and open source extension package designed by Intel® to accelerate the Scikit-learn library.\n\nPlease make sure that your machine architecture/operating system configuration is [supported](https://intel.github.io/scikit-learn-intelex/system-requirements.html) by Intel®   Acceleration before proceeding.\n\nTo quickly check that your computer is supported by Intel Acceleration technology, you could run\nthe following commands in your terminal:\n\n(On Linux)\n```\nlscpu | grep -e \"sse2\\|avx\"\n```\n\n(on Mac OSX)\n```\nsysctl -a | grep cpu.feat\n```\n\n### Sections\n\n1. [Conda environment](#set-up-the-conda-environment)\n\n2. [Data and Code Availability](#data-and-code-availability)\n    \n    2.1 [Download Code](#download-the-machine-learning-benchmark-code)\n    \n    2.2 [Download Data](#downloading-the-benchmark-datasets)\n\n3. [Measuring Energy Consumption](#measuring-energy-consumption)\n    \n    3.1 [Configure RAPL access](#configure-access-to-rapl) \n    \n    3.2 [Tool to monitor energy consumption](#tool-to-monitor-energy-consumption)\n\n4. [Running the Benchmark](#running-the-benchmark)\n\n### Set up the `conda` environment\n\nThe repository provides an  [`environment.yml`](./environment.yml) file that can be used to easy replicate the `conda` environment used in the experiments.\n\nTo do so, it is just necessary to have a working version of `conda` installed on your machine. \n\nAlternatively, it is recommended to  [download](https://www.anaconda.com/products/distribution) and install the **Anaconda Distribution** specific for your architecture, and operating system.\n\nOnce conda is available, please run the following command in the Terminal:\n\n```shell\nconda env create -f environment.yml\n```\n\nThis will create a new `green-ai` conda environment. To double check this, please execute:\n\n```shell\nconda info --envs | grep \"green-ai\"\n```\n\nYou should get an output similar to: \n\n```shell\ngreen-ai                 /Users/leriomaggio/anaconda3/envs/green-ai\n```\n\nThe **last step** is to _activate_ the new conda environment:\n```shell\nconda activate green-ai\n```\n\n**Note** \nPlease also make sure to run the latest version of `conda` on your machine:\n\n```shell\nconda update -n base conda\n```\n\n### Data and Code Availability\n\nAll the experiments reported in the article use the [IntelPython/Machine Learning Benchmark](https://github.com/IntelPython/scikit-learn_bench): a public and open source benchmark for machine learning experiments that supports several machine learning algorithms across multiple data analytics frameworks (e.g. `scikit-learn`, `cuML`, `XGBoost`).\n\nThe benchmark expects experiments to be set up via [configuration files](https://github.com/IntelPython/scikit-learn_bench#running-python-benchmarks-with-runner-script) in JSON format.\n\nThe [experiments](./experiments) folder in this repository contains the configuration files used to run all the experiments described in the article. \n\nIn more details:\n\n| Experiment  | Configuration File | Description |\n| ----------- | ------------------ | ----------- |\n| `Scikit-Learn Public Datasets`  | [skl_public_config.json](./experiments/skl_public_config.json)  | Scikit-learn default benchmark on publicly available datasets |\n| `Classification` models | [classification.json](./experiments/classification.json)  | Classification tasks using `LogisticRegression` and `RandomForestClassifier` models\n| `Regression` models |[regression.json](./experiments/regression.json)  | Regression tasks using `LinearRegression`, `Ridge`, and `RandomForestRegressor` models|\n| `Clustering` models |[clustering.json](./experiments/clustering.json)  | Clustering tasks using `KMeans`, and `DBScan` models|\n| `Dimension Reduction` models| [dimension_reduction.json](./experiments/dimension_reduction.json) | Dimension Reduction experiments using `PCA` and `t-SNE` models|\n| `Support Vector Machines` | [svc_config.json](./experiments/svc_config.json) | Classification and Regression tasks with `SVC`, and `SVR` models|\n\n#### Download the Machine Learning Benchmark Code\n\nTo download the code necessary to run the experiments, it is just necessary to clone the reference repository from GitHub: \n\n```shell\ngit clone https://github.com/leriomaggio/scikit-learn_bench.git -b anaconda-intel-green-ai ./green-ai-benchmark\n```\n\n**Note**: Please note that we will be downloading and use a specific _tagged_ version of the benchmark:\n1. The _tag_ considers the _exact_ same version of code and data used in the experiments.\n2. This version of the benchmark also includes an extra utility script that can be used to download all the necessary benchmark data (see next section). This script is currently part of a [PR](https://github.com/IntelPython/scikit-learn_bench/pull/129) not yet merged into the official `main` branch.\n\n#### Downloading the Benchmark datasets\n\nIt is highly recommended to **download** all the necessary datasets **before** running the experiments. This would avoid any issue during the execution derived by connectivity failures during the download. Moreover, this would also favour a fairer comparisong between multiple experiments, by not including any accidental overhead caused by network failures during the execution.\n\nAssuming that you have cloned the benchmark code directly within the `intel-green-ai` main folder, \nto download all the dataset, run the following command:\n```shell\ncd green-ai-benchmark\nDATASETSROOT=./data python -m datasets.load_datasets --configs ../experiments/skl_public_config.json\n```\n\nThis will download the `25` publicly available datasets used in the benchmark experiments. For further information, please refer to the official [documentation](https://github.com/leriomaggio/scikit-learn_bench/blob/anaconda-intel-green-ai/datasets/README.md).\n\n⚠️ **Please be aware** that this may take several minutes to complete, depending on your Internet connectivity, and it will require around `18 GB` of disk space.\nMoreover, if you are executing the download on a remote machine, it is **higly** recommended to run the previous command within a [`tmux`](https://github.com/tmux/tmux/wiki) session.\n\n## Measuring Energy Consumption\n\nTo measure energy consumption of machine learning experiments, we need (A) to make sure that information about consumed energy is reliably provided by our operating system; and (B) download all the necessary software to read this information during the execution.\n\nTo measure the energy consumed by each experiment we used `RAPL`, that is `R`unning `A`verage `P`ower `L`imit. This technology has been available on any **Intel CPU** since the _Sandy Bridge generation_ (2010, ed.), and it is supported by any operating system (e.g. the [Power Capping](https://www.kernel.org/doc/html/latest/power/powercap/powercap.html) framework on Linux). RAPL allows to estimates the power consumption of the CPU, RAM and any integrated GPU (if any) in real time.\n\nIn our experiments, we used a `c5.metal` [Amazon EC2 instance](https://aws.amazon.com/ec2/instance-types/c5/)  with [Ubuntu 20.04.5 LTS](https://releases.ubuntu.com/focal/) operating system. Therefore, all the following instructions will consider this configuration as the reference to enable RAPL readings.\n\n#### Configure access to RAPL\n\nThe `powercap` framework is **not** enabled by default on Ubuntu OS running on AWS instances. Therefore, the first thing to do is to install all the required _kernel modules_.\n\n**Note**: Please make sure you are running the following commands using a user account with `sudo` permissions.\n\n```shell\nsudo apt install linux-modules-extra-$(uname -r)\nsudo update-initramfs -c -k $(uname -r)\n```\n\nAfterwards, we need to dynamically `probe` (i.e. load) these modules into the kernel. \nTo get the names of these modules, we could search for any kernel module that includes `rapl` in their name:\n\n```shell\nfind /lib/modules/$(uname -r) -name *rapl*\n```\nThe output of the `find` command should look similar to:\n\n```shell\n/lib/modules/5.15.0-1030-aws/kernel/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.ko\n/lib/modules/5.15.0-1030-aws/kernel/drivers/powercap/intel_rapl_msr.ko\n/lib/modules/5.15.0-1030-aws/kernel/drivers/powercap/intel_rapl_common.ko\n/lib/modules/5.15.0-1030-aws/kernel/arch/x86/events/rapl.ko\n```\n\nTherefore, we can load these modules into the kernel by running the following commands:\n\n```shell\nsudo modprobe rapl\nsudo modprobe intel_rapl_common\nsudo modprobe intel_rapl_msr\nsudo modprobe processor_thermal_rapl\n```\n\nTo verify that all went well, we should now be able to see listed the `powercap` folder under the `/sys/class/` folder:\n\n```shell\nls /sys/class/powercap/\nintel-rapl  intel-rapl:0  intel-rapl:0:0  intel-rapl:1  intel-rapl:1:0\n```\n\nThat's all! Well done! 🎉 This was the hardest part. From now on, the rest will be _piece of cake_, I promise.\n\n#### Tool to monitor energy consumption\n\nWe used [`jouleit`](https://powerapi-ng.github.io/jouleit.html) to monitor the energy consumption of our experiments.  `jouleit` does not require any installation, and it is very easy to use. \n\nTo download `jouleit` it is just necessary to clone its GitHub repository:\n\n```shell\ngit clone https://github.com/powerapi-ng/jouleit.git \u003cpath to\u003e/jouleit\ncd jouleit\n```\n\n**To verify** that `jouleit` works and that it's able to read data from RAPL, we could run the script using the `-l` option:\n\n```shell\n./jouleit.sh -l\nCPU;DRAM;DURATION;EXIT_CODE\n```\n\nThe output correspond to the list of headers that the script is able to access, and read from. In this case, `CPU`, `DRAM`, execution time, and `exit_code`of the executed program.\n\n**Note**: If `CPU` and `DRAM` won't be present in the output of the previous command, this would mean that the access to RAPL has not been properly configured.\n\n## Running the Benchmark\n\nThe [`runners`](./runners) folder contains all the script required to execute the multiple benchmark configurations, _with_ (i.e. `xxx_intel_OPTON.sh`) and _without_ (`xxx_intel_OPTOFF.sh`) Intel AI Acceleration. \n\nThese scripts will be used in conjuction with `jouleit` to also monitor energy consumption of each experiment.\n\nFirst, I would recommend copying the `experiments` folder in the main benchmark folder, i.e. the `green-ai-benchmark` folder created in step 2.1:\n\n```shell\ncp -r ./experiments \u003cpath to\u003e/green-ai-benchmark\n```\n\nSimilarly, we should copy all the runner-scripts in the `green-ai-benchmark` main folder, as well:\n\n```shell\ncp ./runners/run_* \u003cpath to\u003e/green-ai-benchmark\n```\n\nThis is required to make sure that all the paths and dependencies will be available when starting the benchmark execution.\n\nNow the last step: executing a single benchmark experiment, whilst also monitoring energy consumption using `jouleit`:\n\n```shell\ncd \u003cpath to\u003e/green-ai-benchmark\n\u003cpath to\u003e/jouleit/jouleit.sh ./run_XXX.sh\n```\n\n⚠️ **A few notes on privilegies and permissions**\n\nAll the RAPL _virtual device_ files require **root privilegies** to be accessed for security reasons. This means that the `jouleit.sh` script requires _root_ to be used. \nHowever, if we would run all the commands using directly the `root` user (e.g. using `sudo`), we would also need to setup \nthe whole conda environment for root, and that would be unpractical. \nTherefore, as a _workaround_  **for the sole sake of this benckmark experiments** - we could change the ownership of those files to grant access:\n\n\n```shell\nsudo chown -R $USER:$USER /sys/class/powercap/intel-rapl*\n```\n\n##### Running `Support Vector Machines` experiments\n\nThe optimised version of the Support Vector machine included in `sklearnex` requires `OpenCL` to be installed and configured. \nTo do so, please make sure that all the required libraries are linked in the right location:\n\n```shell\nsudo mkdir -p /etc/OpenCL/vendors/\nsudo bash -c \"echo libintelocl.so \u003e /etc/OpenCL/vendors/intel64.icd\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanaconda%2Fintel-green-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanaconda%2Fintel-green-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanaconda%2Fintel-green-ai/lists"}