Skip to content

Floppy Documentation

Welcome to the Floppy documentation!

Floppy is a framework for analyzing and counting floating-point operations (FLOPs) in Python code, with special focus on numerical computations using NumPy.

Features

  • Runtime FLOP Counting: Track FLOPs in your code as it executes
  • Transparent array operation tracking
  • Support for high-level NumPy operations
  • Thread-safe operation
  • Selective monitoring of code paths

  • Static Analysis: Analyze potential FLOP operations in your codebase

  • Identify potential FLOP-contributing functions
  • Get insights before execution

Installation

For monty_lab conda environment, please follow instructions from Thousand Brains Project documentation and run:

conda create --clone tbp.monty -n monty_lab
conda activate monty_lab
cd path/to/monty_lab/floppy
pip install -e .

Quick Start

from floppy.counting.base import FlopCounter

with FlopCounter() as counter:
    result = np.matmul(a, b)
    print(f"FLOPs: {counter.flops}")

For analyzing an entire codebase:

python run_static_analysis.py --dir path/to/analyze

Documentation

Contributing

Contributions are welcome! Please follow the Thousand Brains Project Contributing Guide.

License

The MIT License. See the LICENSE for details.