Closed pelesh closed 1 month ago
After looking at possible use cases, I think it is better if update
methods set flags only for memory spaces they updated. A user may run updates for for host and device in separate calls and bring them both to same up-to-date values. In this case "automatic" assumption that the other memory space is out of date would be untrue.
What I suggest is that
updateData
and updateValues
functions set "updated" flags only for the memory space they act on (update).setUpdated
and setNotUpdated
functions.A possible action here would be to allow setNotUpdated
function to set specific memory space as not current. Other functionality is already available in ReSolve.
@maksud, please chime in, as well.
The alternative to my earlier proposal could be to do exactly as @kswirydo suggested -- once device memory is updated alone, the host memory is automatically flagged as out of date. In that case, it would be user's responsibility to sync host and data using syncData
methods in vector and matrix classes when needed. The syncData
method would need to check the destination is out of date and the source is updated, and send warning/error message otherwise.
In
update
methods in vector and matrix classes it is probably safer to set both update flags at the same time - i.e if cpu data gets updated, gpu data automatically should switch to NOT updated._Originally posted by @kswirydo in https://github.com/ORNL/ReSolve/pull/124#discussion_r1429345023_