-
Notifications
You must be signed in to change notification settings - Fork 79
Sample implementation for ArbLattice #535
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
Conversation
llaniewski
left a comment
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.
@lisataldir maybe a meeting would be in order?
| std::unique_ptr<Index[]> og_index; | ||
| std::unique_ptr<Index[]> nbrs; | ||
| std::unique_ptr<ZoneIndex[]> zones_per_node; | ||
| std::vector<Index> cart_index; |
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.
This seems to be only encode the position in a different way. Couldn't we just search in the coords?
src/ArbLattice.cpp
Outdated
| /// Calculation of the offset from x, y and z | ||
| int ArbLattice::Offset(int x, int y, int z) | ||
| { | ||
| return x+connect.nx*y + connect.nx*connect.ny*z; |
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.
This doesn't seem to be a good idea, as the size of the thing can be quite big. Even if we stick with this solution, this should be 64bit (see sizeL in region)
src/ArbLattice.cpp
Outdated
| #ifdef ADJOINT | ||
| setAdjSnapIn(aSnap); | ||
| #endif | ||
| lbRegion small = getLocalBoundingBox().intersect(over); |
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.
This seem to be wrong. The indexes in read from the file are in the global region, a this seems to take smaller (local) region.
src/ArbLattice.cpp
Outdated
| setAdjSnapIn(aSnap); | ||
| #endif | ||
| lbRegion small = getLocalBoundingBox().intersect(over); | ||
| auto it = std::find(connect.cart_index.begin(), connect.cart_index.end(), Offset(small.dx, small.dy, small.dz)); |
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.
This is the only place these indexes are really used. Couldn't it be replaced with search for the closest point in coords?
| lbRegion small = getLocalBoundingBox().intersect(over); | ||
| auto it = std::find(connect.cart_index.begin(), connect.cart_index.end(), Offset(small.dx, small.dy, small.dz)); | ||
| int lid = std::distance(connect.cart_index.begin(), it); | ||
| launcher.SampleQuantity(quant, lid, buf, scale, data); |
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.
It doesn't seem very efficient to search this point every time.
| int x = CudaBlock.x + small.dx; | ||
| int y = CudaBlock.y + small.dy; | ||
| int z = CudaBlock.z + small.dz; | ||
| int x = (CudaBlock.x + small.dx) %container.nx; |
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.
Why did this appear here? x,y,z should always be in container's region, and modulu ("%") is very expensive and generally not very reliable.
| return EXIT_SUCCESS; | ||
| }; | ||
|
|
||
| const auto init_arbitrary = [&](const Lattice<ArbLattice>* lattice) { |
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.
There seems to be lot of overlap between these two functions. Maybe something could be generalized here?
I added a handler Sample for arbitrary lattice (took time to pull it because the implementation is not really efficient)