Package: fecom
FECoM ToolOur tool can calculate the energy consumptionof an entire Tensorflow script (project-level experiments)of each individual TensorFlow function/method from a given script (method-level experiments)of different configurations of the same function/method (data-size experiments)Directory StructureThis repository has the following main directories:data: contains all input and output data used in the study and has three subdirectories:code-datasetcontains patched and original projects from the third-party source code repositoryenergy-datasetcontains all experimental energy dataothercontains failed experimental data or data used for calculating settingsreplication: replication package for the FECoM study.fecom: source code for the FECoM tool.Environment SetupEnergy measurement librariesFirst verify thatperf, a library to measure CPU and RAM energy consumption, is already available in you Linux system, if not then install separately:sudoaptinstalllinux-tools-`uname-r`Also make sure thelm-sensorsCPU temperature measurement library is installed:sudo apt install lm-sensorsThis tool also makes use of theNVIDIA System Management Interfaceornvidia-smito measure GPU energy consumption.Python environmentInstallminiconda3. Then open theenvironment.ymlfile (provided in this directory) in a text editor and change the paths stored asprefix:andvariables:to point at your miniconda installation.Finally, in this directory, run the following command to create the required TensorFlow environment from the specifiedenvironment.ymlfile:conda env create -f environment.ymlActivate the environemnt:conda activate tf2Check if the GPU is setup correctly by runningpython3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"This might give some warnings about missing TensorRT libraries, but as long as the output is[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]there is a good chance that the GPU has been setup correctly. Despite this, an issue faced was an error message thatlibdevice is required by this HLO module but was not found. A fix for this is highlightedhere.Install FECoMIn this (top-level) directory, runpip install .to install the FECoM tool. If you make any changes, for example to the configuration files, you need to repeat this step such that all changes are loaded.ConfigurationAll constants and settings for the measurement script can be found infecom/measurement/measurement_config.py, and for the patching script infecom/patching/patching_config.py. These files are the single source of truth for all used constants.measurement_config.pycontains configurations regardingStable state checkingEnergy measurementsTemperature measurementspatching_config.pycontains patching script file paths.You will need to add your own file paths inpatching_config!Run Energy Consumption ExperimentsStart the energy measurement processes by following the instructions below. Detailed instructions on how to run experiments can be found inreplication/README.md.With the activated conda environment, navigate tofecom/measurementand run this command to startperfandnvidia-smi(energy measurement tools) as well assensors(cpu temperature tool, which is run inside the wrappercpu_temperature.py):python3 start_measurement.pyThe application can be terminated by pressing Control-C.ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.