Skip to content

Floppy is a Python framework for analyzing and counting floating-point operations (FLOPs).

License

Notifications You must be signed in to change notification settings

thousandbrainsproject/tbp.floppy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💾 Floppy: FLOP Analysis and Counting Framework

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

Floppy can be installed in your environment to profile code. For Monty specifically, follow these directions:

  1. First, clone and install the tbp.monty repository in ~/tbp/tbp.monty directory by following instructions from Thousand Brains Project documentation

  2. Next, in ~/tbp/tbp.floppy clone the tbp.monty conda environment via:

conda create --clone tbp.monty -n floppy
conda activate 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 profiling Monty experiments:

python floppy/run_flop_counter.py --experiment=dist_agent_1lm_randrot_x_percent_5p

For statically analyzing a repo:

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.

About

Floppy is a Python framework for analyzing and counting floating-point operations (FLOPs).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages