Skip to main content

IPython extension for monitoring cell performance

Project description

Unit Tests Formatting Static Analysis

JUmPER: Jupyter meets Performance

JUmPER brings performance engineering to Jupyter. It consists of the two repositories:

  • JUmPER Ipython extension (this repository)

This extension is for real-time performance monitoring in IPython environments and Jupyter notebooks. It allows you to gather performance data on CPU usage, memory consumption, GPU utilization, and I/O operations for individual cells and present it in the notebook/IPython session either as text report or as a plot.

The Score-P kernel allows you to instrument, and trace or profile your Python code in Jupyter using Score-P for in-detail performance analysis tasks. The Score-P kernel and the IPython extension can be seamlessly integrated.

Table of Content

Installation

pip install jumper_extension

or install it from source:

pip install .

Quick Start

Load the Extension

%load_ext jumper_extension

Basic Usage

  1. Start monitoring:

    %perfmonitor_start [interval]
    

    interval is an optional argument for configuring frequency of performance data gathering (in seconds), set to 1 by default. This command launches a performance monitoring daemon.

  2. Run your code

  3. View performance report:

    %perfmonitor_perfreport
    %perfmonitor_perfreport --cell 2:5 --level user
    

    Will print aggregate performance report for entire notebook execution so far:

    ----------------------------------------
    Performance Report
    ----------------------------------------
    Duration: 11.08s
    Metric                    AVG      MIN      MAX      TOTAL   
    -----------------------------------------------------------------
    CPU Util (Across CPUs)    10.55    3.86     45.91    -       
    Memory (GB)               7.80     7.74     7.99     15.40   
    GPU Util (Across GPUs)    27.50    5.00     33.00    -       
    GPU Memory (GB)           0.25     0.23     0.32     4.00    
    

    Options:

    • --cell RANGE: Specify cell range (e.g., 5, 2:8, :5)
    • --level LEVEL: Choose monitoring level (process, user, system, slurm)
  4. Plot performance data:

    %perfmonitor_plot
    

    Opens an interactive plot with widgets to explore performance metrics over time, filter by cell ranges, and select different monitoring levels.

  1. View cell execution history:

    %cell_history
    

    Shows an interactive table of all executed cells with timestamps and durations.

  2. Stop monitoring:

    %perfmonitor_stop
    
  3. Export data for external analysis:

    %perfmonitor_export_perfdata my_performance.csv --level system
    %perfmonitor_export_cell_history my_cells.json
    

    Export performance measurements for entire notebook and cell execution history with timestamps, allowing you to project measurements onto specific cells.

Metrics Collection

Performance Monitoring Levels

The extension supports four different levels of metric collection, each providing different scopes of system monitoring:

  • Process: Metrics for the current Python process only
  • User: Metrics for all processes belonging to the current user
  • System: System-wide metrics across all processes and users (if visible)
  • Slurm: Metrics for processes within the current SLURM job

Collected Metrics

Metric Description
cpu_util CPU utilization percentage
memory Memory usage in GB
io_read_count Total number of read I/O operations
io_write_count Total number of write I/O operations
io_read_mb Total data read in MB
gpu_util GPU compute utilization percentage across GPUs
gpu_band GPU memory bandwidth utilization percentage
gpu_mem GPU memory usage in GB across GPUs
io_write_mb Total data written in MB

Note: GPU metrics require NVIDIA GPUs with pynvml library. Memory limits are automatically detected from SLURM cgroups when available.

Available Commands

Command Description
%perfmonitor_help Show all available commands with examples
%perfmonitor_resources Display available hardware resources
%perfmonitor_start [interval] Start monitoring (default: 1 second interval)
%perfmonitor_stop Stop monitoring
%perfmonitor_perfreport [--cell RANGE] [--level LEVEL] Show performance report for specific cell range and monitoring level
%perfmonitor_plot Interactive plot with widgets for exploring performance data
%cell_history Show execution history of all cells with interactive table
%perfmonitor_enable_perfreports Auto-generate reports after each cell
%perfmonitor_disable_perfreports Disable auto-reports
%perfmonitor_export_perfdata [filename] [--level LEVEL] Export performance data to CSV
%perfmonitor_perfdata_to_dataframe [df_name] [--level LEVEL] Export performance data to Pandas dataframe
%perfmonitor_export_cell_history [filename] Export cell history to CSV/JSON

Contribution and Citing:

PRs are welcome. Feel free to use the pre-commit hooks provided in .githooks

If you publish some work using the kernel, we would appreciate if you cite one of the following papers:

Werner, E., Rygin, A., Gocht-Zech, A., Döbel, S., & Lieber, M. (2024, November).
JUmPER: Performance Data Monitoring, Instrumentation and Visualization for Jupyter Notebooks.
In SC24-W: Workshops of the International Conference for High Performance Computing, Networking, Storage and Analysis (pp. 2003-2011). IEEE.
https://www.doi.org/10.1109/SCW63240.2024.00250

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

jumper_extension-0.2.1.tar.gz (52.2 kB view details)

Uploaded Source

Built Distribution

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

jumper_extension-0.2.1-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file jumper_extension-0.2.1.tar.gz.

File metadata

  • Download URL: jumper_extension-0.2.1.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for jumper_extension-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d9b7e4574e8e598ba7dc73343b656a96f0dc7dba4986e20e0648b8d4dbecd592
MD5 ce0aec06c44cd6a3deded80feca90ae6
BLAKE2b-256 d01e0981c3d326ec48365545a59d69c6f4bf605881f7407c92c1020c4f0e0be6

See more details on using hashes here.

File details

Details for the file jumper_extension-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jumper_extension-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9eda94e656b3adcab33d8192625246215708af43ab2f3d6183fbd5c84e87362f
MD5 9532b70464bdb170b67d875f0c2ef8d3
BLAKE2b-256 e342cc55db090618f374fee47abb540e3327a51b64b4ba136a449d4d84463183

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