fix aosoa/controller lifetime issue and remove relaxed constexpr flag - #92
Merged
Conversation
this triggers the copy ctor which in turn requires the relaxed constexpr flag, see #37
I don't like the inconsistent treatment of the coordinate field inside omegahmeshfield (i.e., it owns the controller since it created the coord field in the ctor). I'd also prefer that the user only had to deal with the field handles, not the controller lifetime. Reference counting the aosoa so it remains alive and requiring the user to keep the controller alive for each field is the current compromise. There is most certainly a better approach to keep host-only constructs off the device... but this will have to do for now. all tests run under asan are now passing
Contributor
Author
|
/runtests |
| ShapeField(MeshFieldType &meshFieldIn, const MeshInfo &meshInfoIn, | ||
| Mixins... mixins) | ||
| : meshField(meshFieldIn), meshInfo(meshInfoIn), Mixins(mixins)... {}; | ||
| ShapeField(const MeshInfo &meshInfoIn, Mixins... mixins) |
Contributor
Author
There was a problem hiding this comment.
will be resolved outside PR
|
Test Result: success (details) |
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.
KokkosController'sstd::tuple<Kokkos::View<Ts, MemorySpace>...>member forced NVCC to treat its constructor as__host__ __device__whenever aShapeFieldholding it (stored asShapeField::meshField) was captured into a device lambda. Removing that member (which was unused... except for keeping the controller in-scope) eliminates theconstexprviolation and the need for the--expt-relaxed-constexprcompiler flag.Removing the compiler flag subsequently revealed a bug with the
CabanaController.CabanaController's slices are non-owning views into itsaosoamember, andShapeField::meshFieldwas the only thing keeping thataosoaalive past the factory function that created it (confirmed with asan).Changes:
CabanaController::aosoais now wrapped instd::shared_ptr- copies of the controller share (rather than duplicate/free) the underlying storageCreateLagrangeFieldandCreateCoordinateFieldnow returnFieldWithController{ctrlr, field}instead of a bare field, making lifetime ownership of theControllerexplicit to the caller instead of hidden insideShapeField.OmegahMeshFieldand all call sites updated accordingly.ControllerLifetimeTestandCabanaControllerLifetimeTestas regression coverage for object lifetimeresolves #37 and #90