Skip to content

Implemented sampler on Arbitrary grid and fixes for cartesian one#541

Merged
llaniewski merged 5 commits intoCFD-GO:developfrom
shkodm:sampler_arb
Mar 12, 2026
Merged

Implemented sampler on Arbitrary grid and fixes for cartesian one#541
llaniewski merged 5 commits intoCFD-GO:developfrom
shkodm:sampler_arb

Conversation

@shkodm
Copy link
Copy Markdown
Member

@shkodm shkodm commented Mar 5, 2026

On Arbitrary grid:

  • Moved sample to the lattice base
  • Implemented executor to map cartesian coordinate into local id by an array scan with a tolerance. This is the only solution I think that avoid additional array allocations
  • Otherwise the functions are similar to the cartesian ones
  • To not search for index on every iteration, cached the point index inside the sample points attribute (not that much extra memory, should be ok)

On Cartesian grid

  • Fixed a bug that on multiple GPUs the sample point location was never converted to the local coordinate frame, so was returning wrong results (because intersect does the intersection of bounding boxes, not the conversion into coordinate frames). Fix by offsetting the point into the local coordinate system

Tested by:

  • Print local ids of different sampling points across 1 and 2 gpus
  • Running sampler with several points on 1 GPU, and 2 GPUs and comparing results for both cartesian and arb lattice (to make sure the distribution of points works) - this is how I found the problem with the cartesian lattice, I think Lisa saw something like that previously
  • Comparing sampler results between cartesian and arbitrary lattice on 1 and 2 gpus - no difference

Bounding Box changes are the same as in #540

Comment thread src/ArbLatticeLauncher.hpp.Rt Outdated

CudaDeviceFunction void Execute() const {
using LA = ArbLatticeAccess;
using N = Node< LA, Primal, NoGlobals, Get >;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No node type is used here.

shkodm added 3 commits March 12, 2026 15:41
The problem was that the "intersection" of regions
does not convert to the local coordinates, so the "over"
coordinates were incorrecte (still global)
Were not triggered previously because destructor
was virtual. Now more consistent with CartLattice
@shkodm
Copy link
Copy Markdown
Member Author

shkodm commented Mar 12, 2026

Had the same issue with override virtual functions as in #540 (comment). Should be fixed now

@llaniewski llaniewski merged commit 6a422cc into CFD-GO:develop Mar 12, 2026
53 checks passed
@shkodm shkodm deleted the sampler_arb branch March 12, 2026 22:32
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

Successfully merging this pull request may close these issues.

2 participants