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:
- Recording individual transfer measurements via
BandwidthProfiler::record. - Summarizing collected data with
BandwidthProfiler::summaryorBandwidthProfiler::summary_by_direction. - Estimating transfer times and utilization with the standalone functions
estimate_transfer_time,theoretical_peak_bandwidth, andbandwidth_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§
- Bandwidth
Benchmark Config - Configuration for a bandwidth benchmark sweep.
- Bandwidth
Measurement - A single transfer bandwidth measurement.
- Bandwidth
Profiler - Accumulates bandwidth measurements and produces summary statistics.
- Bandwidth
Summary - Aggregated bandwidth statistics across all recorded measurements.
- Direction
Summary - Aggregated statistics for transfers in a single direction.
Enums§
- Transfer
Direction - 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.