Skip to main content

GPU Monitoring Client

Project description

GPUFlight Client Library (gpufl)

🚩 Project Status: Active Research & Development

GPU Flight is currently in an early "Active Research" phase. The core architecture and C++ engine are being rapidly iterated upon.

To ensure the integrity of the initial design, we are not currently accepting major feature Pull Requests. However, we welcome:

  • 🐛 Bug reports and local build issues.
  • 📖 Documentation improvements and typo fixes.
  • 💡 Feature requests and architectural suggestions via GitHub Issues.

The Flight Recorder for GPU Production Workloads.

gpufl is a lightweight, high-performance C++ observability library designed for always-on monitoring of GPU applications. Unlike traditional profilers (Nsight) that stop the world, GPUFlight is designed to run in production with minimal overhead, capturing kernel telemetry and logical scopes into structured logs.

🚀 Key Features

  • Kernel Monitoring: Automatically intercepts all CUDA kernel launches via CUPTI.
  • Production Grade: Uses a Lock-Free Ring Buffer and a Background Collector Thread to decouple logging from your hot path.
  • Logical Scoping: Group thousands of micro-kernels into meaningful phases (e.g., "Inference", "PhysicsStep") using GFL_SCOPE.
  • Rich Metadata: Captures Kernel Names, Grid/Block dimensions, Register counts, and Shared Memory usage.
  • Sidecar Ready: Outputs structured NDJSON logs designed to be tailed by a separate Agent/Crawler (e.g., Kafka/Elastic).
  • Vendor Agnostic Design: Architecture ready for AMD (ROCm) support.

📦 Integration

C++ Integration

gpufl is designed to be pulled in via CMake FetchContent.

Python Integration

Install the library with all analysis and visualization dependencies:

pip install ".[numba,viz,analyzer]"

📊 Python Analysis & Visualization

The gpufl Python library provides a powerful suite for analyzing logs produced by the C++ library.

1. Analyzer (CLI Dashboard)

Use the analyzer module to get an "Executive Summary" of your GPU performance directly in the terminal.

from gpufl.analyzer import GpuFlightSession

# Load a session (automatically picks up .kernel, .scope, and .system logs)
session = GpuFlightSession("./logs", log_prefix="stress")

# 1. Executive Summary: Duration, Utilization, Peak VRAM
session.print_summary()

# 2. Hierarchical Scope Analysis: Time spent in GFL_SCOPE blocks
session.inspect_scopes()

# 3. Kernel Hotspots: Top expensive kernels with Stack Trace visualization
session.inspect_hotspots(top_n=5, max_stack_depth=5)

Analyzer example output

2. Visualization (Timeline)

The viz module provides interactive matplotlib plots to correlate kernel execution with system metrics.

import gpufl.viz as viz

# Load all logs in a directory
viz.init("./logs/*.log")

# Show interactive timeline with:
# - GPU/Host utilization & VRAM
# - Kernel occupancy markers
# - Hover-able kernel names (to reduce clutter)
viz.show()

🛠️ Usage (C++)

CMakeLists.txt

cmake_minimum_required(VERSION 3.20)
project(my_app LANGUAGES CXX CUDA)

include(FetchContent)
FetchContent_Declare(
    gpufl
    GIT_REPOSITORY [https://github.com/gpu-flight/gpufl-client.git](https://github.com/gpu-flight/gpufl-client.git)
    GIT_TAG        main 
)
FetchContent_MakeAvailable(gpufl)

add_executable(my_app main.cu)

# Link against gpufl and required CUDA libraries
target_link_libraries(my_app PRIVATE gpufl CUDA::cudart CUDA::cupti)

# Ensure DLLs are copied on Windows (Optional but recommended)
# See 'Troubleshooting' section for post-build commands.

🧪 Testing

The project includes a suite of unit tests using GoogleTest. These tests are hardware-aware and will automatically skip NVIDIA-specific tests if a compatible GPU or driver is not detected.

Running Tests (C++)

The C++ tests use GoogleTest and are hardware-aware.

  1. Build the tests:

    cmake --build cmake-build-debug --target gpufl_tests
    
  2. Run via CTest:

    ctest --test-dir cmake-build-debug --output-on-failure
    
  3. Run directly:

    ./cmake-build-debug/tests/gpufl_tests.exe
    

Running Tests (Python)

The Python tests use pytest and verify the analyzer and visualization logic using mocked data.

  1. Install pytest:

    pip install pytest
    
  2. Run tests:

    # Ensure python directory is in PYTHONPATH
    export PYTHONPATH=$PYTHONPATH:$(pwd)/python
    pytest tests/python
    

Running Tests (CLion)

  • The gpufl_tests target will appear in your run configurations.
  • You can run individual tests or the entire suite using the built-in GoogleTest runner.

🔧 Linux Configuration (Required for CUPTI)

To allow non-root users to profile GPU kernels (using CUPTI/PC Sampling) on Linux, you must relax the NVIDIA driver security restrictions. Without this, gpufl may fail to capture kernel activity.

  1. Create a configuration file:
    sudo nano /etc/modprobe.d/nvidia-profiler.conf
    
  2. Add the following line:
    options nvidia NVreg_RestrictProfilingToAdminUsers=0
    
  3. Apply changes and reboot:
    sudo update-initramfs -u
    sudo reboot
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpufl-0.1.0.dev0.tar.gz (201.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gpufl-0.1.0.dev0-cp313-cp313-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.13Windows x86-64

gpufl-0.1.0.dev0-cp313-cp313-manylinux_2_28_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

gpufl-0.1.0.dev0-cp312-cp312-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.12Windows x86-64

gpufl-0.1.0.dev0-cp312-cp312-manylinux_2_28_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

File details

Details for the file gpufl-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: gpufl-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 201.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gpufl-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 4503a708cf02bf007ebcb964d9cec8135d9e0983a965925f8dc9aacbbc004587
MD5 0ae86f47ef365acd8d99a95945dca7ac
BLAKE2b-256 cbbf0ec26e29abfc2df7451126302952a7b8c75860261b76e804871b90f38688

See more details on using hashes here.

File details

Details for the file gpufl-0.1.0.dev0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: gpufl-0.1.0.dev0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gpufl-0.1.0.dev0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 97faf4e753d42fdf092aca97c61b5b4ce7306d967492809dc052dc3679f782f1
MD5 00336fe657dfe5cc626e234c009d247c
BLAKE2b-256 d334e5b58fd0cb20b8b41a2c45f058400eb42c784cce7562181e09a09bde9a13

See more details on using hashes here.

File details

Details for the file gpufl-0.1.0.dev0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gpufl-0.1.0.dev0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cb341210e24d95238114010fff078d8d89120d11ca27e8986eb296aa3efa3e74
MD5 725c16433869418250b8f57228cacf09
BLAKE2b-256 11052765bafa96cbd63e67876a7e64d6c58e17d059da7805e67821e710d0fdd1

See more details on using hashes here.

File details

Details for the file gpufl-0.1.0.dev0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: gpufl-0.1.0.dev0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gpufl-0.1.0.dev0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b44798ee955eb01a6ddb292fa1b53f0ee2a258c384a206958beca73f4fa5234c
MD5 bd69c65264329852d9a73316aafad193
BLAKE2b-256 0ea33aa17cc17fac152a3cd1a06fdf2fab426f371a6131b6b29a0502d881a4ed

See more details on using hashes here.

File details

Details for the file gpufl-0.1.0.dev0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gpufl-0.1.0.dev0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23bfdb536c9f5b3edeaeb9f3a4739ae585eeaf7f19d83d9fadcb305ad19a4688
MD5 4de14fff595a0ca064b4f34193e71ed9
BLAKE2b-256 e2e83969017cfb05c1034b4f35d5c8f5534c81e89db65a63bbef3ea9554973bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page