Skip to content

Fix IMEX RK on GPU#654

Merged
pancetta merged 1 commit into
Parallel-in-Time:masterfrom
brownbaerchen:IMEX_RK_fix
Jun 12, 2026
Merged

Fix IMEX RK on GPU#654
pancetta merged 1 commit into
Parallel-in-Time:masterfrom
brownbaerchen:IMEX_RK_fix

Conversation

@brownbaerchen

Copy link
Copy Markdown
Contributor

Ok, sometimes I see why people are frustrated with Python. This deep-copy / shallow copy bug that made RK443 blow up on GPUs was quite hard to find...

Copilot AI review requested due to automatic review settings June 11, 2026 21:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a GPU-specific failure in the IMEX Runge–Kutta sweeper by ensuring the stage right-hand side is created as an independent dtype_u object (instead of aliasing lvl.u[0]), avoiding unintended in-place modification / shallow-copy aliasing on array-backed GPU data types.

Changes:

  • Initialize rhs via prob.dtype_u(lvl.u[0]) to force a deep copy rather than referencing lvl.u[0].
  • Assign lvl.u[m+1] directly from rhs instead of using rhs[:], avoiding view/alias semantics for ndarray-like types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pancetta

Copy link
Copy Markdown
Member

Good catch. These bugs suck, big time.

@pancetta pancetta merged commit 892e8a6 into Parallel-in-Time:master Jun 12, 2026
42 checks passed
@tlunet

tlunet commented Jun 12, 2026

Copy link
Copy Markdown
Member

Classic : programming in python looks easy, but properly doing it is not 😅

@pancetta

Copy link
Copy Markdown
Member

I'm glad we now have AI for th.. oh, wait..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants