sandialabs / Albany

Sandia National Laboratories' Albany multiphysics code
Other
282 stars 89 forks source link

Fix bug related to Kokkos::vector replacement #1036

Closed mcarlson801 closed 8 months ago

mcarlson801 commented 8 months ago

This PR fixes a bug that only shows up in debug builds and was introduced by the recent changes to replace Kokkos::vector. DualView's resize sets the modify flag on device and then a later call to modify_host causes the modify flag to be true on both host and device. With a debug build, this situation causes an exception to be thrown.

This fix adds a sync after the resize to clear the modify flags. Looking at the implementation of DualView's resize, it looks like there might be situations where the host modify flag is set instead. Therefore, I've added syncs for host and device just in case. It's not an elegant solution but whichever one is unnecessary will be a no-op.

mcarlson801 commented 8 months ago

Also, I noticed that the typedef is still using KV = ..., which is a bit confusing since KV is not a vector but a DualView. Would you mind chaning that to something like using DV = ... or using DualView = ..., which is a bit more self-documenting?

Good call, I'll go ahead and update that.