Repository navigation
Checkout api - #319
Merged
Merged
Checkout api#319
Conversation
with_local_arrays!(f!, g_fx, l_x) checks out both local arrays, on the device when a GPU extension is loaded, calls f!(fx, lx), and hands them back also when f! throws. local_arrays and restore_local_arrays! now warn: an exception between the two calls left both Vecs checked out.
with_local_coordinate_array(f, dm) calls f with the local coordinates of a DMDA or DMStag, addressed with global indices, and hands the array back when f returns or throws. local_coordinate_array now warns and returns a copy: its array used to be handed back by a finalizer, which crashed Julia when the DM was destroyed first.
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.
Two do-block checkouts that hand the arrays back when the block returns or throws.
with_local_arrays!(f!, g_fx, l_x)replaces thelocal_arrays/restore_local_arrays!pair, which left both Vecs checked out if anything threw in between. GPU placement (device arrays, host bounce buffer) is unchanged.with_local_coordinate_array(f, dm)replaceslocal_coordinate_array, whose array was handed back by a finalizer. That crashed Julia when the DM was destroyed before the GC ran it; the old function now warns and returns a copy.The old functions still work and warn. The CUDA path isn't exercised here (no GPU in CI or locally); its extension methods are unchanged.