A hardware-agnostic Python library to monitor the computational cost (FLOPs and BOPs) of Machine and Deep Learning algorithms. Full support for PyTorch and Scikit-learn.
pip install floppy-tracker
In the era of Green AI, execution time or energy consumption are not enough: they depend heavily on the hardware. FLOPpy measures the true intrinsic complexity of your model.
Compare the efficiency of different architectures regardless of whether you are using a CPU, a T4 GPU, or an A100. FLOPs and BOPs don't lie.
FLOPs alone do not capture the savings of quantization. FLOPpy natively tracks BOPs to quantify the real benefits of FP16, INT8, and INT4.
Don't stop at inference. FLOPpy analyzes the entire training loop: Forward and Backward passes, Loss functions, optimizers, and even tokenization.
Profile `torch` (including Hugging Face) and `scikit-learn` models using a single, consistent API.
No need to modify your model's code. Transparent integration via patching and low-level hooks (ATen dispatch).
Native support for quantized layers and fused optimizers (e.g., BitsAndBytes, DeepSpeed, Apex) that usually bypass standard profilers.
Seamless synchronization with WandB for real-time visualization of metrics during training.
FLOPpyTracker Summary "experiment_name" =================================================== System Environment: - OS : Linux (x86_64) | 2016 GB RAM - CPU : AMD EPYC 7742 64-Core - GPU : 1x NVIDIA A100-SXM4-80GB - Libs : PyTorch 2.2.2+cu121 | Scikit-learn 1.6 Computational Workload Breakdown: - Model (Forward) : 414.72 KFLOPs | 13.27 MBOPs - Model (Backward) : 500.22 KFLOPs | 16.01 MBOPs - Loss (Forward) : 11.52 KFLOPs | 368.64 KBOPs - Optimizer (Update): 136.44 KFLOPs | 4.37 MBOPs --------------------------------------------------- OVERALL TOTAL : 1.06 MFLOPs | 34.01 MBOPs ===================================================
FLOPpy employs high-precision, transparent strategies across different frameworks to ensure maximum accuracy without requiring any changes to your original code.
TorchDispatchMode to intercept underlying C++ ATen dispatch calls in real-time, capturing operations even outside standard nn.Module objects.
torch.Tensor.backward to encapsulate the entire Autograd graph execution.
fit, predict, transform) to extract input/output array dimensions at runtime.
fit() operations are mapped as Model (Backward) training phase, while predict() is reported as Model (Forward) inference.
Add FLOPpy to your existing code with just a few lines of code.
import torch.nn as nn
from floppy import FLOPpyTracker, WandbConfiguration
from transformers import AutoModel
wandb_config = WandbConfiguration(
project_name="your_experiment",
group_name="your_group",
reporter_key="your_wandb_key_here"
)
# 1. Define your model, loss and optimizer
model = nn.Sequential(nn.Linear(10, 10), nn.ReLU())
loss_fn = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters())
num_epochs = 10
# 2. Initialize the tracker
tracker = FLOPpyTracker(run_name="pytorch_experiment")
# 3. Run monitoring
tracker.run(model=model, optimizer=optimizer, loss_fn=loss_fn)
# 4. Do something with the model
for _ in range(num_epochs):
for xb, yb in your_data_loader:
optimizer.zero_grad()
y_hat = model(xb)
loss = loss_fn(y_hat, yb)
loss.backward()
optimizer.step()
tracker.batch() # Optional: track metrics per batch
tracker.epoch() # Optional: track metrics per epoch
# 5. Access the report
report = tracker.report()
print(report)
from sklearn.ensemble import RandomForestClassifier
from floppy import FLOPpyTracker
# 1. Define your model
model = RandomForestClassifier(n_estimators=100)
# 2. Initialize the tracker
tracker = FLOPpyTracker(run_name="sklearn_test")
# 3. Run monitoring
tracker.run(model=model)
# 4. Do something with the model
model.fit(X_train, y_train)
preds = model.predict(X_test)
# 5. Access the report
report = tracker.report(print_summary=True)
FLOPpy is developed by researchers at the Institute of High Performance Computing and Networking (ICAR-CNR).
If you use FLOPpy in your research, please cite our work on hardware-agnostic computational workload estimation for Machine and Deep Learning algorithms.
@article{SCALA2026102865,
title = {FLOPpy: A hardware-agnostic Python library to monitor the computational cost of machine and deep learning algorithms},
journal = {SoftwareX},
volume = {35},
pages = {102865},
year = {2026},
issn = {2352-7110},
doi = {https://doi.org/10.1016/j.softx.2026.102865},
url = {https://www.sciencedirect.com/science/article/pii/S2352711026003572},
author = {Francesco Scala and Francesco Mandarino and Liliana Martirano and Luigi Pontieri},
keywords = {Green AI, Computational workload, Hardware-agnostic, Deep learning, Machine learning, Floating point operations, Bit-operations}
}