-
Notifications
You must be signed in to change notification settings - Fork 10
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
Move on resize/insert/emplace...etc #167
Comments
Thinking about this more I'm not sure this is desired behavior. For example if you have an With the current behavior this what happens is calling With the new behavior the Array1d< int > x( 55 );
x.move( MemorySpace::GPU ):
// Creates a new allocation of size 66 on the device and launches a kernel which
// captures `x.toViewConst()` and populates the new allocation default initializing
// the new values. It then deallocates the old device and host allocations.
x.resize< devicePolicy >( 66 ); We could also do something special for Also if we add in these |
After working with it a bit, I am pretty sure this is not the desired behavior. It seems a bit arbitrary where to move the data, and the fact that we are always moving the data back to host when it is not required on host seems wasteful as you point out. The solution of adding I kind of like the |
@corbett5 @klevzoff I think that your suggestion about having policy based reallocation functions is a good start. So to lay it all out...when we have registered an
So the first is the standard mesh data case, and the second is something like a set of indices, etc. In the case of
The second case is harder to deal with. Some of the difficulty is in the multiple ways to get to
So where does the |
How about adding an Prior to any reallocation, we would have to call
Then you can call
Then you call
|
Yes.
I don't think that
This isn't really important as it doesn't effect the usage. I would suggest that it only does not do the second allocation upon resize. That way you could have an
There will always be operations that can only be done on the host
I'm pretty sure we don't want void bar( Group & group )
{
ArrayView<> x = group.getReference< Array<> >( "x" );
foo( x );
} If
I'm not sure what this accomplishes that a policied resize doesn't. For non resize methods like |
In the case of a class member Is the
If the
It would be nice to have some infrastructure support to help the user with the intricacies of these operations in LvArray. The
I am pretty sure too.
Whatever works. I just don't want to have to find the places where i need to call |
You mean
It would be nice for timing purposes to include the second allocation in the |
@corbett5 Yes. sorry.
So the data repository is not involved in this call to resize.
We should definitely have an option for allocation in a target memory space. We will need this when device memory is larger than host memory. |
@corbett5 I started to include the call to move for the cases we discussed (resize, reserve), but this is actually a larger issue which we should have a unified approach for. It is really a situation where upon every type of array size/capacity modification that must be done on host, we should move back to host prior to performing the operation. This should be done across the board for all types (Array, ArrayOfArrays, CRSMatrix, SortedArray...).
Pros/Cons:
move
. It seems like we may callmove
multiple times with the way that the manipulation functions are setup. I don't know if this is a real issue, but I guess move is essentially a no-op if the buffer is already current on host? I think it is fine, but perhaps it isn't.The text was updated successfully, but these errors were encountered: