Skip to content

Spherical Metrics #30

Closed
Closed

Description

@jbphyswx

Build actual parallel transport for SFs on the sphere tangent/normal vectors.
Assuming with Distances.Haversine (check GPU performance)

Activity

  1. jbphyswx commented on Sep 6, 2026

    @jbphyswx
    OwnerAuthor

    Implemented and closed out, including the (check GPU performance) half.

    Parallel transport is wired through every kernel family — pair_frame / pair_direction / pair_delta / pair_invariants, with FlatGeometry and SphericalGeometry, right-handed n̂ = ẑ × r̂. Covered on CPU (serial, threaded, MPI, Distributed), KA.CPU() and CUDA.

    Performance. The per-pair frame was rewritten onto ambient unit vectors, removing ~8 transcendentals per pair:

    path ns/pair
    flat, SIMD kernel 28.0
    flat, scalar kernel 38.7
    sphere, before 198.2
    sphere, after 65.0

    3.05× on CPU. On an A100, single-pass 1-D throughput (10⁹ atom-pairs/s):

    N FT euclidean haversine
    65 536 F32 44.2 31.7
    65 536 F64 26.7 17.2

    so spherical now runs at 61–72 % of flat throughput on device.

    Two defects found and fixed on the way:

    • The joint-2D GPU kernels were width-2 only, so flat D = 3 joint-2D had never worked on GPU and spherical joint-2D broke once x became 3-wide. The codegen is now parameterised on coordinate width.
    • A silent conditioning failure at antipodal separation. geodesic_frame's docstring claimed ok = false for both coincident and antipodal pairs; it was false only at σ = 0. Measured against BigFloat on generic pairs, the returned direction was wrong by 38 % at π − σ = 1e-15 and accepted, with error scaling as ε/(π−σ). Fixed with a second tolerance on ‖p̂+q̂‖²; refusing is correct rather than conservative, since antipodal points are joined by infinitely many great circles.

    Also added: a lat-lon fast path exploiting the zonal invariance of the geodesic frame (measured 147× faster than the pair loop on a 48×24 grid, pair counts exactly equal), and support for pixelized spheres (HEALPix) through the same entry point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions