Open
Conversation
This commit introduces enhanced bounds checking macros that provide detailed error messages when bounds violations occur in debug mode. Changes: - Added MATAR_CHECK_BOUNDS macro for Kokkos View arrays with labels - Added MATAR_CHECK_BOUNDS_NO_LABEL macro for raw pointer arrays - Added MATAR_CHECK_BOUNDS_MATRIX macro for 1-based matrix indexing - Added MATAR_CHECK_BOUNDS_MATRIX_NO_LABEL macro for View matrix types - Added MATAR_CHECK_ORDER macro for order/rank validation - Added MATAR_CHECK_ORDER_NO_LABEL macro for View types without labels - Replaced 717 bounds checking assert statements with the new macros The macros provide enhanced error output including: - File location and line number - Class name where the error occurred - Array label (when available) - Index name and value that caused the violation - Expected dimension size or valid range In release mode (NDEBUG defined), all macros compile to no-ops for zero runtime overhead. Addresses: lanl#151 Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
The Location output (__FILE__:__LINE__) was pointing to the header file rather than the user's code, making it unhelpful for debugging. The array label and class name provide sufficient context for identifying which array caused the bounds violation. Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
This improves debugging by showing the exact dimension of the array operation that caused a bounds violation, e.g.: [MATAR BOUNDS ERROR] Class: FArrayKokkos 3D Array Label: my_array Index 'k' = 10 is out of bounds (dimension size = 5) Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
This fixes compilation errors where the MATAR_CHECK_* macros expected 'this_array_' but matrix classes used 'this_matrix_' and ragged classes used 'array_'. Changes: - Renamed this_matrix_ to this_array_ in all matrix classes (FMatrixKokkos, CMatrixKokkos, ViewFMatrixKokkos, ViewCMatrixKokkos, etc.) - Renamed array_ to this_array_ in all ragged array classes (RaggedRightArrayKokkos, RaggedDownArrayKokkos, CSRArrayKokkos, CSCArrayKokkos, DynamicRaggedRightArrayKokkos, etc.) This ensures consistent naming across all classes and allows the MATAR_CHECK_BOUNDS macros to access the array label for error messages. Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
…kkos The MATAR_CHECK_BOUNDS macro was incorrectly using 'd' instead of 'i' as the first parameter in the dims() and dims_max() functions. Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
This allows the same macros to work with different array types: - Regular Kokkos views: this_array_.label().c_str() - Dual views (DCArrayKokkos, etc.): this_array_.h_view.label().c_str() - View types (raw pointers): "" (empty string) Changes: - Consolidated MATAR_CHECK_BOUNDS and MATAR_CHECK_BOUNDS_NO_LABEL into single MATAR_CHECK_BOUNDS with label parameter - Consolidated MATAR_CHECK_BOUNDS_MATRIX and MATAR_CHECK_BOUNDS_MATRIX_NO_LABEL into single MATAR_CHECK_BOUNDS_MATRIX with label parameter - Consolidated MATAR_CHECK_ORDER and MATAR_CHECK_ORDER_NO_LABEL into single MATAR_CHECK_ORDER with label parameter - Macros now conditionally print label only if non-empty - Updated all 711 macro calls with appropriate label accessor Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
DDynamicRaggedRightArrayKokkos uses DualView, so it needs to access the label via this_array_.h_view.label().c_str() instead of this_array_.label().c_str(). Also fixed the class name in the error message from 'DynamicRaggedRightArrayKokkos' to 'DDynamicRaggedRightArrayKokkos'. Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
Fixed three bounds checks for the 'j' index in DRaggedRightArrayKokkos that were incorrectly using this_array_.label() instead of this_array_.h_view.label() for DualView access. Also fixed class name in error messages from 'RaggedRightArrayKokkos' to 'DRaggedRightArrayKokkos'. Co-authored-by: Jacob Moore <jacob-moore22@users.noreply.github.com>
gavinwhetstone
approved these changes
Feb 13, 2026
Collaborator
gavinwhetstone
left a comment
There was a problem hiding this comment.
i don't see any issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds useful information for debugging with asserts to call out what data structure is the bad actor.