Skip to main content

Module bandwidth_profiler

Module bandwidth_profiler 

Source
Expand description

Memory bandwidth profiling and throughput measurement.

This module provides tools for measuring and analyzing transfer bandwidth between host and device memory. It supports profiling of host-to-device, device-to-host, device-to-device, and host-to-host transfers.

§Overview

The profiling workflow consists of:

  1. Recording individual transfer measurements via BandwidthProfiler::record.
  2. Summarizing collected data with BandwidthProfiler::summary or BandwidthProfiler::summary_by_direction.
  3. Estimating transfer times and utilization with the standalone functions estimate_transfer_time, theoretical_peak_bandwidth, and bandwidth_utilization.

§Example

use oxicuda_memory::bandwidth_profiler::*;

let mut profiler = BandwidthProfiler::new();

// Record some measurements
let m = BandwidthMeasurement::new(
    TransferDirection::HostToDevice,
    1_048_576, // 1 MB
    0.5,       // 0.5 ms
);
profiler.record(m);

let summary = profiler.summary();
println!("{summary}");

Structs§

BandwidthBenchmarkConfig
Configuration for a bandwidth benchmark sweep.
BandwidthMeasurement
A single transfer bandwidth measurement.
BandwidthProfiler
Accumulates bandwidth measurements and produces summary statistics.
BandwidthSummary
Aggregated bandwidth statistics across all recorded measurements.
DirectionSummary
Aggregated statistics for transfers in a single direction.

Enums§

TransferDirection
Direction of a memory transfer operation.

Functions§

bandwidth_utilization
Returns the bandwidth utilization ratio (0.0–1.0).
describe_bandwidth
Returns a human-readable description of a bandwidth value.
estimate_transfer_time
Estimates the transfer time in milliseconds for a given data size.
format_bytes
Formats a byte count into a human-readable string (e.g., “1.00 MB”).
theoretical_peak_bandwidth
Returns the theoretical peak unidirectional bandwidth for a PCIe configuration in GB/s.