Skip to main content

DFTracer logo

DFTracer

Version: $(cat PACKAGE_VERSION 2>/dev/null || echo "2.0.2")

Build and Test Coverage Status Documentation Status PyPI - Version PyPI - Wheel PyPI - Python Version PyPI - License

Overview

DFTracer is a tracing tool designed to capture both application-code and I/O-call level events from workflows. It provides a unified tracing interface, optimized trace format, and compression mechanism to enable efficient distributed analysis for large-scale AI-driven workloads.

Prerequisites

Requirements for DFTracer

  1. Python>=3.7
  2. pybind11

Requirements for DFAnalyzer

  1. bokeh>=2.4.2
  2. dask>=2023.5.0
  3. distributed
  4. matplotlib>=3.7.3
  5. numpy>=1.24.3
  6. pandas>=2.0.3
  7. pyarrow>=12.0.1
  8. pybind11
  9. python-intervals>=1.10.0.post1
  10. rich>=13.6.0
  11. seaborn>=0.13.2
  12. zindex_py

Installation

Users can easily install DFTracer using pip, the standard tool for installing Python packages. This method works for both native Python and Conda environments.

From PyPI

pip install dftracer
pip install dftracer[dfanalyzer]
# if you want to use old version of DFAnalyzer
# pip install dftracer[dfanalyzer_old]

This installs a prebuilt wheel that traces POSIX and STDIO I/O. It needs nothing from the host, but it cannot trace MPI, HDF5 or HIP — see With MPI, HDF5 or HIP support.

Development builds are published from every merge into develop, versioned <last release>.postN, as both wheels and an sdist:

pip install --pre dftracer          # newest prerelease
pip install dftracer==2.1.0.post5   # a specific one

From Github

DFTRACER_VERSION=develop
pip install git+https://github.com/llnl-asr/dftracer.git@${DFTRACER_VERSION}
pip install git+https://github.com/llnl-asr/dftracer.git@${DFTRACER_VERSION}#egg=dftracer[dfanalyzer]
# if you want to use old version of DFAnalyzer
# pip install git+https://github.com/llnl-asr/dftracer.git@${DFTRACER_VERSION}#egg=dftracer[dfanalyzer_old]

From Source

git clone https://github.com/llnl-asr/dftracer.git
cd dftracer
# You can skip this for installing the dev branch.
# for latest stable version use master branch.
git checkout tags/<Release> -b <Release>
pip install .

With MPI, HDF5 or HIP support

These are compile-time options, so they need a build against the libraries you actually run with. The prebuilt wheel cannot carry them: DFTracer intercepts calls into the MPI/HDF5 library the application loads, and the interception is generated for a specific implementation and version, so a wheel built elsewhere would trace nothing. Build from the source distribution instead, the way mpi4py does:

# MPI and HDF5 must be discoverable by CMake (module load, spack load, ...)
DFTRACER_ENABLE_MPI=ON DFTRACER_ENABLE_HDF5=ON \
  pip install --no-binary dftracer dftracer

--no-binary dftracer is what makes pip build from source rather than take the wheel. Only dftracer itself is built from source; its build tools still come as wheels. The same works for a checkout (pip install .) or a release tarball.

The options below are read from the environment by setup.py and passed to CMake. All default to OFF unless stated:

Variable Effect
DFTRACER_ENABLE_MPI MPI rank in traces and MPI/MPI-IO interception
DFTRACER_ENABLE_HDF5 HDF5 interception
DFTRACER_ENABLE_HIP_TRACING AMD GPU tracing, needs ROCm/rocprofiler-sdk
DFTRACER_ENABLE_FTRACING function tracing via -finstrument-functions
DFTRACER_ENABLE_DYNAMIC_DETECTION detect HWLOC, MPI and HIP at run time instead of link time
DFTRACER_DISABLE_HWLOC HWLOC support, ON (disabled) by default
DFTRACER_MPI_IMPL override MPI implementation detection
DFTRACER_BUILD_TYPE Release (default) or Debug

Requirements for a source build: a C++17 compiler whose standard library provides std::filesystem (GCC 9 or newer; note that a system libstdc++ older than the compiler on the PATH can shadow it and fail the link), CMake 3.24 or newer, and the development packages of whatever you enable.

The C/C++ dependencies (cpp-logger, GOTCHA, brahma, yaml-cpp, libuv) are built automatically. Their source archives ship inside the source distribution, so a source install needs no access to their repositories. When building from a git clone, fetch the ones that are not committed first:

scripts/wheel/fetch_deps.sh

To confirm the build traces what you enabled, run your application with DFTRACER_ENABLE=1 and check that the trace contains the matching categories (MPI, MPIIO, HDF5) and not only POSIX.

For detailed build instructions see docs/build.rst in this repository, or the rendered documentation when it is reachable.

Usage

from dftracer.python import dftracer, dft_fn
log_inst = dftracer.initialize_log(logfile=None, data_dir=None, process_id=-1)
dft_fn = dft_fn("COMPUTE")

# Example of using function decorators
@dft_fn.log
def log_events(index):
    sleep(1)

# Example of function spawning and implicit I/O calls
def posix_calls(val):
    index, is_spawn = val
    path = f"{cwd}/data/demofile{index}.txt"
    f = open(path, "w+")
    f.write("Now the file has more content!")
    f.close()
    if is_spawn:
        print(f"Calling spawn on {index} with pid {os.getpid()}")
        log_inst.finalize() # This need to be called to correctly finalize DFTracer.
    else:
        print(f"Not calling spawn on {index} with pid {os.getpid()}")

# NPZ calls internally calls POSIX calls.
def npz_calls(index):
    path = f"{cwd}/data/demofile{index}.npz"
    if os.path.exists(path):
        os.remove(path)
    records = np.random.randint(255, size=(8, 8, 1024), dtype=np.uint8)
    record_labels = [0] * 1024
    np.savez(path, x=records, y=record_labels)

def main():
    log_events(0)
    npz_calls(1)
    with get_context('spawn').Pool(1, initializer=init) as pool:
        pool.map(posix_calls, ((2, True),))
    log_inst.finalize()

if __name__ == "__main__":
    main()

For this example, as the dftracer.initialize_log do not pass logfile or data_dir, we need to set DFTRACER_LOG_FILE and DFTRACER_DATA_DIR. By default the DFTracer mode is set to FUNCTION. Example of running this configurations are:

# The process id, app_name and .pfw will be appended by DFTracer for each app and process.
# The name of the final log file will be ~/log_file-<APP_NAME>-<PID>.pfw
DFTRACER_LOG_FILE=~/log_file
# Colon separated paths to include in the tracing
DFTRACER_DATA_DIR=/dev/shm/:/p/gpfs1/$USER/dataset:$PWD/data
# Enable DFTracer
DFTRACER_ENABLE=1

For more examples, click here.

Documentation

Citation and Reference

The original SC'24 paper describes the design and implementation of the DFTracer code. Please cite this paper and the code if you use DFTracer in your research.

@inproceedings{devarajan_dftracer_2024,
    address = {Atlanta, GA},
    title = {{DFTracer}: {An} {Analysis}-{Friendly} {Data} {Flow} {Tracer} for {AI}-{Driven} {Workflows}},
    shorttitle = {{DFTracer}},
    urldate = {2024-07-31},
    booktitle = {{SC24}: {International} {Conference} for {High} {Performance} {Computing}, {Networking}, {Storage} and {Analysis}},
    publisher = {IEEE},
    author = {Devarajan, Hariharan and Pottier, Loic and Velusamy, Kaushik and Zheng, Huihuo and Yildirim, Izzet and Kogiou, Olga and Yu, Weikuan and Kougkas, Anthony and Sun, Xian-He and Yeom, Jae Seung and Mohror, Kathryn},
    month = nov,
    year = {2024},
}

@misc{devarajan_dftracer_code_2024,
    type = {Github},
    title = {Github {DFTracer}},
    shorttitle = {{DFTracer}},
    url = {https://github.com/llnl-asr/dftracer.git},
    urldate = {2024-07-31},
    journal = {DFTracer: A multi-level dataflow tracer for capture I/O calls from worklows.},
    author = {Devarajan, Hariharan and Pottier, Loic and Velusamy, Kaushik and Zheng, Huihuo and Yildirim, Izzet and Kogiou, Olga and Yu, Weikuan and Kougkas, Anthony and Sun, Xian-He and Yeom, Jae Seung and Mohror, Kathryn},
    month = jun,
    year = {2024},
}

Acknowledgments

This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344; and under the auspices of the National Cancer Institute (NCI) by Frederick National Laboratory for Cancer Research (FNLCR) under Contract 75N91019D00024. This research used resources of the Argonne Leadership Computing Facility, a U.S. Department of Energy (DOE) Office of Science user facility at Argonne National Laboratory and is based on research supported by the U.S. DOE Office of Science-Advanced Scientific Computing Research Program, under Contract No. DE-AC02-06CH11357. Office of Advanced Scientific Computing Research under the DOE Early Career Research Program. Also, This material is based upon work partially supported by LLNL LDRD 23-ERD-045 and 24-SI-005. LLNL-CONF-857447.

License

DFTracer is distributed under the terms of the MIT license. All new contributions must be made under this license.

See LICENSE and NOTICE for details.

SPDX-License-Identifier: MIT

LLNL-CODE-2024514 — Applied Storage Research (ASR)

Metadata

Release files for dftracer 2.1.1.post42

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

Source distribution (sdist)

Source distribution for dftracer 2.1.1.post42
File Size Uploaded
dftracer-2.1.1.post42.tar.gz 18.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for dftracer 2.1.1.post42
File
dftracer-2.1.1.post42-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
dftracer-2.1.1.post42-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
dftracer-2.1.1.post42-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
dftracer-2.1.1.post42-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
dftracer-2.1.1.post42-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
dftracer-2.1.1.post42-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details

Total release size: 86.2 MB

Release files / dftracer-2.1.1.post42.tar.gz

Download URL dftracer-2.1.1.post42.tar.gz
Size 18.2 MB
Tags Source
SHA-256 checksum
How to use checksums
9357cc5f4795b6da7f60f3632f01eef8181685a03a29381638a9485707179db3
BLAKE2b-256 checksum
How to use checksums
d4030f48e3be0fbf39017582cfa5487fd33465c3b5253c5e2137654f303eb4ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp314-cp314-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b9986ac0e8d38dd8a1be92b93f217129a30d72ba26482457151560d99f037289
BLAKE2b-256 checksum
How to use checksums
ab0030aad282d516d17793498708223fb5072ee1af613f8e9de94c7c5d75fdba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp313-cp313-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
af1f8a509ef8b76ac32af2627ce6163830561add59da37e94198c96550329064
BLAKE2b-256 checksum
How to use checksums
e3f2ae6c87e44627d6ef663cabf0b4533473e38e5edfe56b67a9281b8899dba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp312-cp312-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
bf7f2eb82529757f31027ace75c3eade92c68171d7127bc3e6c10866d232d5e2
BLAKE2b-256 checksum
How to use checksums
de0c33b6192492314c355406fcadfb4a78e585627f5018c0777cc661e7d168cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp311-cp311-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
167a4bd3412c28e76e2fd0033aafe87133f4c60ee50f18dc3e5ae6ff1412ac69
BLAKE2b-256 checksum
How to use checksums
e5b656f59e96f5aa8582b0e25a1a689188055f9cf26b90c65d1bb719a2ce613b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp310-cp310-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
69e83f1269314e944aeb5fb49099911e2af6b94991f5fd3b9ae7aa2ed97d1d99
BLAKE2b-256 checksum
How to use checksums
88f4f8264f90931747442ebb28b8ac7e72e3699ad650676f9be26abde0b7bc84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dftracer-2.1.1.post42-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL dftracer-2.1.1.post42-cp39-cp39-manylinux_2_28_x86_64.whl
Size 11.3 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b23ff4c85c503dd321e0ac11430b7b43e0ea7d8d86cd32c763686c5c8c4bf1d6
BLAKE2b-256 checksum
How to use checksums
2f16e56d036ad0d3f285b9b6da5b4520d3ae30a600eca7775b796ac0452f441b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
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