Skip to content

Plan: octrees, filters, distributed forests and rendering (#498) - #517

Open
berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:docs/plan-octrees
Open

berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:docs/plan-octrees

Conversation

@berkgeveci

Copy link
Copy Markdown
Collaborator

The plan for #498, as docs/design/plans/octrees.md. It plans the move of the octree study (branch vis/octrees on berkgeveci/tack-fork, about 13,000 lines and 200 tests, never reviewed) into Tack, in nine PRs.

Measured in the study:

  • Every filter is faster than VTK's hyper tree grid filters on 8 threads at 1M leaves: contour 6 against 82 ms, dual grid 54 against 1909 ms.
  • Deep Water Impact (xRAGE): 82M cells volume rendered in 29 ms a frame on a laptop GPU.
  • Rendering across MPI ranks is within 0.01 of one rank's picture, and interactive at 4 ranks.

Decisions D1-D13, each with a recommendation; reply per decision. In three groups:

  • Dataset and filters (D1-D7):
    • main's linear octree plus with_fields;
    • topology derived once, never searched by filters;
    • the td names where the meaning is the same (td.contour(octree, ...));
    • octree-to-octree and exact cell-data filters;
    • explicit reconstruction (piecewise constant, the dual grid, tents);
    • contour on the dual.
  • Distributed (D8-D10):
    • local forests with REMOTECELL placeholders;
    • a one-leaf ghost ring through the existing ghost_cells(pieces, layers=1, world=), by Routing;
    • seams decided by ownership (by level and slot, never by rank), so the output does not depend on the partition.
  • Rendering (D11-D13):
    • the tent sampler and a marcher;
    • one compositor over tack.communication (a fragment a box in kd order, direct send);
    • a new package, tack-rendering (tack.rendering).

Out of this plan: file I/O, the demand-driven VTK reader, simulating on octrees (#493, to a separate repository), readers and in-situ adaptors, and repartitioning.

Docs only: mkdocs build --strict is clean.

This plan will be merged (accepted) after the 0.8 release.

🤖 Generated with Claude Code


- **piecewise constant**: `leaves()`, and every D4 and D5 filter;
- **the dual grid**: leaf centres as points, a cell for each corner where leaves
meet (VTK's hyper tree grid dual), linear on it. Contour and derivatives use it;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

D7 takes gradients from face neighbours by least squares, not from the dual. One of the two needs to change.

cell's triangles where it is crossed, carrying other fields to the points. Its
triangles are VTK's hyper tree grid contour's (a test compares them).
`gradients` of a cell field uses face neighbours: a least-squares fit over the
face neighbours' centres, weighted by inverse squared distance, exact for a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A leaf beside finer leaves has as its face neighbour the refined node of its own size. What value does that node give: one read from the file, or average_up computed first? From from_cells data, refined nodes have none.

- **One layer suffices with 2:1 balance**, which xRAGE and RAMSES enforce: every
dual cell of an owned leaf lies in its neighbourhood. Balance is checked, and
a reply that is itself refined is probed again one level deeper.
- **Owners are found by boxes**, not by a key-to-rank function, which xRAGE's

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Boxes fit imported data. If Tack later partitions forests itself, would the curve's owner lookup replace the box search there, with the ring built the same way?


A rank emits a dual cell, a triangle, a face or a gradient only when its **owner
leaf** is its own: for a dual cell the finest leaf around its corner, the lowest
slot on a tie; for a face the smaller side, the lower on a tie; for a gradient

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The output is the same however the ranks are cut only if "slot" means something every rank computes the same way, such as (tree, level, key). An index into the local forest differs from rank to rank. Please define it.

owned or duplicate, and mark the duplicates.

Reductions across ranks (`average_up` over split trees, `project_along`'s
columns, histograms) go through `all_reduce` and `exclusive_scan` in global-id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all_reduce of each rank's partial sums adds them in an order that depends on the partition, so the floating-point bits differ when a tree is cut differently. Getting the same bits needs a fixed order of combination (gather, then sum in global order) or exact summation. Otherwise, say the results agree to rounding, not bit for bit.

continuous across sizes. A device class, so a marcher or a kernel of one's own
calls it.
- **`corner_values(octree, field)`**: the tents' values at each leaf's corners,
computed once (7 s at 82M cells), after which a sample is trilinear in its leaf.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

On which device? A time series pays this once a step, and again whenever the field changes. If that's on the CPU, the plan should say whether it becomes a kernel.

@jlee-kitware

Copy link
Copy Markdown
Collaborator

The filters, the D10 rule (seams decided by which leaf owns them) and the rendering look right. One scope question first. This plan reads forests that other codes made. Is a p4est-like layer (refine and coarsen, balance enforced, partition along a space-filling curve, ghosts) meant to come later in Tack, or with #493 in the other repository? I'd like it in Tack, under both, so that D8 to D10 and #493 share one forest, with partitioning by box search for imported data and by the curve for forests Tack makes. If that's later, a line in "Not in this plan" saying where it goes would settle it.

This branch has not been deployed

No deployments
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