cubie.outputhandling.summarymetrics.max
Maximum value summary metric for CUDA-accelerated batch integration.
This module implements a summary metric that tracks the maximum value encountered during integration for each variable.
Classes
|
Summary metric to calculate the maximum value of a variable. |
- class cubie.outputhandling.summarymetrics.max.Max[source]
Bases:
SummaryMetric
Summary metric to calculate the maximum value of a variable.
This metric tracks the maximum value encountered during integration by maintaining a running maximum in the buffer and outputting the final maximum at the end of each summary period.
Notes
The metric uses a single buffer slot per variable to store the current maximum value. The buffer is initialized to a very negative number (-1.0e30) to ensure any real value will be captured as the maximum.
- CUDA_factory()[source]
Generate CUDA device functions for maximum value calculation.
Creates optimized CUDA device functions with fixed signatures for updating running maximums and saving final results.
- Returns:
Tuple containing (update_function, save_function) for CUDA execution.
- Return type:
tuple[callable, callable]
Notes
The generated functions have the following signatures:
- update(value, buffer, current_index, customisable_variable):
Updates the running maximum if the new value is larger.
- save(buffer, output_array, summarise_every, customisable_variable):
Saves the current maximum to output and resets buffer.
- __init__()[source]
Initialize the Max summary metric.
Creates CUDA device functions for updating and saving maximum values and configures the metric with appropriate buffer and output sizes.
- save_device_func: Callable
- update_device_func: Callable