LvArray
LvArray copied to clipboard
Rework `Macros.hpp` for devices
The MSG
argument fo the LVARRAY_ERROR_IF
is useless when used on a GPU (device):
https://github.com/GEOS-DEV/LvArray/blob/86af5bfb5204d94dd7b1f4bcf98a37b8de9a630c/src/Macros.hpp#L148
For example, the expression in https://github.com/GEOS-DEV/LvArray/blob/86af5bfb5204d94dd7b1f4bcf98a37b8de9a630c/src/ArraySlice.hpp#L56-L57
is printed as Array Bounds Check Failed: index= << index << m_dims[0]= << m_dims[0]
in the stacktraces (unevaluated, hence not helpful).
One could use printf
or snprintf
together with MSG
and ...
variadic macros arguments which can be used as printf(MSG, __VA_ARGS__);
maybe in combination with __VA_OPT__
.