Fix for non-contiguous arrays#653
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses an output-writing failure caused by non-contiguous NumPy arrays produced when skipping copies (introduced in #652), by ensuring solutions are converted to C-contiguous arrays before being written to disk. This keeps the operation zero-copy when the input is already contiguous, while safely copying otherwise.
Changes:
- Ensure
processSolutionForOutputreturns a C-contiguousnp.ndarrayvianp.ascontiguousarray(...)to prevent IO failures on non-contiguous views (including GPU-to-CPU transfers and.realviews).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Was that the reason of the "unstable RK443" ? 😅 |
No without this the code just crashes on CPU with more than one task. Luckily I found the issue with RK443 and fixed it in #654... So sadly RK443 is not unconditionally unstable after all :D |
Turns out skipping the copy in #652 can lead to non-contiguous arrays that need to be cast to contiguous before writing. If the array is already contiguous, this is zero-copy.