-
Notifications
You must be signed in to change notification settings - Fork 2
Track updated status for each vector in multivector. #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
I see not all checkmarks are there. Is this still a draft? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First -- this is not a bug. What you are adding is a new feature
. There is nothing wrong with current approach except ... it is limiting in some cases.
@@ -280,13 +307,32 @@ namespace ReSolve { namespace vector { | |||
{ | |||
using namespace ReSolve::memory; | |||
|
|||
bool all_gpu_updated = gpu_updated_[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I follow the logic here. If the length of gpu_updated
and 'cpu_updated' is k, shouldnt we just check every vector separately and copy, if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! This function syncs the entire multivector at once. It can do that only if all vectors in the multivector have the same updated status. Otherwise, it should exit with an error. Next few lines check if it is the case. After that, it is safe to use all_gpu_updated
.
The check itself may add some overhead. Perhaps it should be enabled only in debug mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I see what you are doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and tests pass, but maybe we want a test for this specifically? Separate PR?
Vector
class object is a multivector that allows access to individual vectors separately. It is plausible to expect that individual vectors could be updated individually and some of them may have device, while others may have host memory space updated. However, current implementation of theVector
class allows only for setting update flags for all vectors together, regardless of how they are accessed and updated. This is a bug, see #259.This PR provides following:
syncData
overload to sync only one vector in multivector object. ClosesVector::getData
function incorrectly syncs memory spaces. #259.setToZero
andsetToConst
methods. Closes Vector initialization functions do not set "updated" flags correctly #216.Checklist:
-Wall -Wpedantic -Wconversion -Wextra
.