Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

XProf (+ Tensorboard Profiler Plugin)

An open, scalable, and extensible profiler for the modern ML stack.

About ✧ Installation ✧ Usage ✧ Resources ✧ Citing

Badge to display Apache 2.0 license Badge to display current XProf version Badge to display weekly PyPi downloads

About

XProf offers a number of tools to analyse and visualize the performance of your model across multiple devices. Some of the tools include:

Overview Page

A high-level overview of the performance of your model. This is an aggregated overview for your host and all devices. It includes:
  • Performance summary and breakdown of step times.
  • A graph of individual step times.
  • High level details of the run environment.

Trace Viewer

Displays a timeline of the execution of your model that shows:
  • The duration of each op.
  • Which part of the system (host or device) executed an op.
  • The communication between devices.

Memory Profile

Monitors the memory usage of your model.

Graph Viewer

A visualization of the graph structure of HLOs of your model.

To learn more about the various XProf tools, check out the XProf documentation

[!TIP] New to profiling? Come and check out this Colab Demo.

Installation

To get the most recent release version of XProf, install it via pip:

$ pip install xprof

Alternative installation options:

Installation with Tensorboard
$ pip install xprof tensorboard
Google Cloud

If you use Google Cloud to run your workloads, we recommend the xprofiler tool.It provides a streamlined profile collection and viewing experience using VMs running XProf.

Nightly Releases

Every night, a nightly version of the package is released under the name of xprof-nightly. This package contains the latest changes made by the XProf developers.

To install the nightly version of profiler:

$ pip uninstall xprof tensorboard-plugin-profile
$ pip install xprof-nightly
Build from Source

If the pip packages don't work, you can build XProf from source using Bazel.

1. Set up Bazel

Bazel is the build system used for XProf. Bazelisk is a wrapper for Bazel that simplifies Bazel version management. Download the appropriate .deb package for your system from the Bazelisk releases page and install the downloaded package:

sudo apt install ~/Downloads/bazelisk-amd64.deb

2. Obtain the Repository

Clone the XProf GitHub repository to your local machine:

git clone https://github.com/openxla/xprof.git
cd xprof

3. Build the Project

Build the pip Package: Use Bazel to build the XProf pip package:

bazel run --config=public_cache plugin:build_pip_package

Navigate to the Bazel Output Directory and install:

cd /tmp/profile-pip
pip install .

Building on macOS (Apple Silicon)

On macOS the native profiler extension must be built explicitly, pinning the SDK and minimum OS version. Building without these flags fails with errors such as an xcrun SDK macosx10.11 that cannot be located and undefined symbols (_PyModule_Create2). The following invocation is verified on Apple Silicon:

bazel build --config=macos --config=public_cache --macos_sdk_version=$(xcrun --show-sdk-version) --macos_minimum_os=13.0 //xprof/pywrap:profiler_plugin_c_api.so

Usage

Standalone

If you have profile data in a directory (e.g., profiler/demo), you can view it by running:

$ xprof --logdir=profiler/demo --port=6006

Or with the optional command name:

$ xprof server --logdir=profiler/demo --port=6006

With TensorBoard

If you have TensorBoard installed, you can run:

$ tensorboard --logdir=profiler/demo

If you are behind a corporate firewall, you may need to include the --bind_all tensorboard flag.

Go to localhost:6006/#profile of your browser, you should now see the demo overview page show up. Congratulations! You're now ready to capture a profile.

Command-Line Arguments

When launching the XProf server from the command line, you can use the following arguments:

Command Shorthand Default Description
--logdir <path> -l <path> The directory containing XProf profile data (files ending in .xplane.pb). If provided, XProf will load and display profiles from this directory. If omitted, XProf will start without loading any profiles.1
--port <port> -p <port> 8791 The port for the XProf web server.
--grpc_port <port> -g <port> 50051 The port for the gRPC server used for distributed processing. This must be different from --port.
--worker_service_address <addresses> -w <addresses> 0.0.0.0:<grpc_port> A comma-separated list of worker addresses (e.g., host1:50051,host2:50051) for distributed processing.
--hide_capture_profile_button -h N/A If set, hides the 'Capture Profile' button in the UI.
--enable_tab_name_label -e False If set, shows a per-tab name label in the UI.
--src_prefix <prefix> -s <prefix> A prefix prepended to source file paths, used for source-code linking in the UI.
--max_concurrent_worker_requests <n> -m <n> 1 The maximum number of concurrent requests a worker's gRPC server will process, used in distributed profiling.

1 You can dynamically load profiles using session_path or run_path URL parameters, as described in the Log Directory Structure section.

Log Directory Structure

When using XProf, profile data must be placed in a specific directory structure. XProf expects .xplane.pb files to be in the following path:

<log_dir>/plugins/profile/<session_name>/
  • <log_dir>: This is the root directory that you supply to tensorboard --logdir.
  • plugins/profile/: This is a required subdirectory.
  • <session_name>/: Each subdirectory inside plugins/profile/ represents a single profiling session. The name of this directory will appear in the TensorBoard UI dropdown to select the session.

Example:

If your log directory is structured like this:

/path/to/your/log_dir/
└── plugins/
    └── profile/
        ├── my_experiment_run_1/
        │   └── host0.xplane.pb
        └── benchmark_20251107/
            └── host1.xplane.pb

You would launch TensorBoard with:

tensorboard --logdir /path/to/your/log_dir/

The runs my_experiment_run_1 and benchmark_20251107 will be available in the "Sessions" tab of the UI.

You can also dynamically load sessions from a GCS bucket or local filesystem by passing URL parameters when loading XProf in your browser. This method works whether or not you provided a logdir at startup and is useful for viewing profiles from various locations without restarting XProf.

For example, if you start XProf with no log directory:

xprof server

You can load sessions using the following URL parameters.

Assume you have profile data stored on GCS or locally, structured like this:

gs://your-bucket/profile_runs/
├── my_experiment_run_1/
│   ├── host0.xplane.pb
│   └── host1.xplane.pb
└── benchmark_20251107/
    └── host0.xplane.pb

There are two URL parameters you can use:

  • session_path: Use this to load a single session directly. The path should point to a directory containing .xplane.pb files for one session.

    • GCS Example: http://localhost:8791/?session_path=gs://your-bucket/profile_runs/my_experiment_run_1
    • Local Path Example: http://localhost:8791/?session_path=/path/to/profile_runs/my_experiment_run_1
    • Result: XProf will load the my_experiment_run_1 session, and you will see its data in the UI.
  • run_path: Use this to point to a directory that contains multiple session directories.

    • GCS Example: http://localhost:8791/?run_path=gs://your-bucket/profile_runs/
    • Local Path Example: http://localhost:8791/?run_path=/path/to/profile_runs/
    • Result: XProf will list all session directories found under run_path (i.e., my_experiment_run_1 and benchmark_20251107) in the "Sessions" dropdown in the UI, allowing you to switch between them.

Loading Precedence

If multiple sources are provided, XProf uses the following order of precedence to determine which profiles to load:

  1. session_path URL parameter
  2. run_path URL parameter
  3. logdir command-line argument

Distributed Profiling

XProf supports distributed profile processing by using an aggregator that distributes work to multiple XProf workers. This is useful for processing large profiles or handling multiple users.

Worker Node

Each worker node should run XProf with a gRPC port exposed so it can receive processing requests. You should also hide the capture button as workers are not meant to be interacted with directly.

$ xprof server --grpc_port=50051 --port=9999 --hide_capture_profile_button

Aggregator Node

The aggregator node runs XProf with the --worker_service_address flag pointing to all available workers. Users will interact with aggregator node's UI.

$ xprof server --worker_service_address=<worker1_ip>:50051,<worker2_ip>:50051 --port=6006 --logdir=profiler/demo

Replace <worker1_ip>, <worker2_ip> with the addresses of your worker machines. Requests sent to the aggregator on port 6006 will be distributed among the workers for processing.

For deploying a distributed XProf setup in a Kubernetes environment, see Kubernetes Deployment Guide.

Resources

Citing XProf

To cite XProf, please use the following BibTeX entry for the MLSys 2026 paper:

@inproceedings{1076558,
  title     = {XProf: An Open, Scalable and Extensible Profiling System for the Modern ML Stack},
  author    = {Robert Hundt and Naveen Kumar and Jose Baiocchi Paredes and Scott Goodson and Clive Verghese and Prasanna Rengasamy and Kelvin Le and Jiya Zhang and Charles Alaras and Yin Zhang and Kan Cai and Jiten Thakkar and Sai Ganesh Bandiatmakuri and Yogesh SY and Ani Udipi and Vikas Aggarwal},
  year      = {2026},
  booktitle = {Ninth Conference on Machine Learning and Systems}
}

Release files for xprof-nightly 2.24.2a20260923

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for xprof-nightly 2.24.2a20260923
File Interpreter ABI Platform
xprof_nightly-2.24.2a20260923-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
xprof_nightly-2.24.2a20260923-py3-none-manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64 Details
xprof_nightly-2.24.2a20260923-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 114.8 MB

Release files / xprof_nightly-2.24.2a20260923-py3-none-win_amd64.whl

Download URL xprof_nightly-2.24.2a20260923-py3-none-win_amd64.whl
Size 24.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
29797faaa090fc27e8bf3a95d6bf7fa88be5b5d23b5f9e28afc3cf31e4de5eb1
BLAKE2b-256 checksum
How to use checksums
fdca1155a7408cc4a8989a06ff38dfa9e08e40d84eadce9451df91e403c68bad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.14

Release files / xprof_nightly-2.24.2a20260923-py3-none-manylinux_2_35_aarch64.whl

Download URL xprof_nightly-2.24.2a20260923-py3-none-manylinux_2_35_aarch64.whl
Size 46.3 MB
Tags Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f3da6af126947d0bc03d168d0457ebcc9a03c0339054359f42d4c0c9a1ae1524
BLAKE2b-256 checksum
How to use checksums
4c4f5fe4cb39c5cc9019ed12324753a8b3c849ba9a067d86fe93451daf5b0295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.14

Release files / xprof_nightly-2.24.2a20260923-py3-none-macosx_11_0_arm64.whl

Download URL xprof_nightly-2.24.2a20260923-py3-none-macosx_11_0_arm64.whl
Size 44.5 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e52be71a9778b0cf7c378f54541280845f92a39079636de62ceaf48b3beb5238
BLAKE2b-256 checksum
How to use checksums
b1a66e6cddd46b4d3d31b8e610d6b5f2fdfb31e293d552cc566cb5199ceb33e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page