Skip to content
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

Implementation of compounded vectors. #423

Closed
nychiang opened this issue Mar 11, 2022 · 4 comments
Closed

Implementation of compounded vectors. #423

nychiang opened this issue Mar 11, 2022 · 4 comments
Assignees

Comments

@nychiang
Copy link
Collaborator

It's better to implement something for blocked vectors, e.g., a wrapper for multiple single vectors in a compound vector.
By doing this, we can have better memory management in HiOp.
For instance, we can avoid unnecessary data transfer in this function .

@pelesh
Copy link
Collaborator

pelesh commented Mar 11, 2022

It might be a good idea to consider vector views that do not own the data, but are used for user/application to read/write from appropriate locations. In the example you are showing, you would allocate only *ir_x0_ and all the other vectors would be views of different sections of *ir_x0_. Vector views are lightweight objects and can be allocated on the stack, so the implementation could be quite efficient.

My concern is if you go with a wrapper of multiple vectors, it is difficult to control where in the memory these vectors will be allocated. If parts of *ir_x0_ are allocated "everywhere", one could run into excessive cache misses.

@cnpetra
Copy link
Collaborator

cnpetra commented Mar 17, 2022

Vector views is definitely a good idea for performance. But I think the "views" need to implement hiopVector interface, otherwise code gets messy. Modifying existing hiopVector implementations so that they don't own the data would do this without much effort (plus some methods to create such views based on (start,length) pairs).

But, imo, compound vectors (of vectors, including vector views) will still be useful to keep the code simple.

@pelesh
Copy link
Collaborator

pelesh commented Mar 17, 2022

The way I see it, implementing vector view could be as easy as adding another constructor or two to the existing vector class plus a flag indicating if the object owns the data. I agree, having a block (compound) vector object in addition to vector views would indeed help remove explicit pointer arithmetic from algorithm classes without significant performance hit.

@cnpetra cnpetra self-assigned this Mar 17, 2022
@cnpetra cnpetra changed the title Implementation of blocked vectors. Implementation of compounded vectors. Mar 17, 2022
@nychiang
Copy link
Collaborator Author

Closed by #621

@cnpetra cnpetra closed this as completed Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants