Skip to content

3D SUMMA: optional sorted output + SpParMat3D EWiseApply, OpenMP local EWiseApply, and a radixSort correctness fix - #35

Open
akashgrao wants to merge 5 commits into
PASSIONLab:masterfrom
akashgrao:pr/ewiseapply-omp-radix-3d
Open

akashgrao wants to merge 5 commits into
PASSIONLab:masterfrom
akashgrao:pr/ewiseapply-omp-radix-3d

Conversation

@akashgrao

Copy link
Copy Markdown

This PR addresses 3D-distributed eWiseApply support plus a standalone correctness fix for an off-by-one error in the PBBS radix sort (commit 1742a3a). Together they enable layer-local multi-threaded eWiseApply on SpParMat3D operands, which we use downstream to build min-plus 3D-SUMMA APSP kernels on CombBLAS.

Changes:

  1. radixSort off-by-one fix (correctness) : PBBS/radixSort.h: the std::pair overload passed maxV where iSort needs maxV+1 (keys range [0,maxV]); the max key mis-sorts when maxV is a power of two, silently corrupting MultiwayMergeHash/SerialMergeHash output.
  2. Optional sorted Mult_AnXBn_SUMMA3D output : ParFriends.h: new bool sortOutput=false (default = unchanged fast/unsorted; true row-sorts, per-layer + fiber, for sorted-merge consumers).
  3. EWiseApply for SpParMat3D : layer-local, no fiber comm; requires sorted+aligned operands.
  4. OpenMP local EWiseApply + move ctors : Friends.h, plus Dcsc/SpDCCols O(1) move constructors.
  5. Test: ReleaseTests/EWiseApply3DTest.cpp + CMake.
  6. SetSeq() - A helper function in case developers want access to the seq object (I did.....willing to remove if it doesnt work with how you want it).

akashgrao and others added 5 commits July 20, 2026 16:25
Friends.h: OpenMP-parallel local Dcsc EWiseApply (both-operands-non-NULL
predicate path), gated by THREADED with the original serial code kept as the
#else fallback (byte-identical output). Threshold-split column-merge, fused
per-column symbolic count, parallel prefix-sum, exact-size uninitialized
allocation, merge-path numeric fill.

dcsc.h: Dcsc move constructor + move assignment (steal the arrays) so
returning a Dcsc by value moves instead of doing a serial O(nnz) deep copy.

Verified byte-identical to the serial kernel across inputs; scales
near-linearly under spread NUMA placement on Perlmutter (AMD EPYC 7763).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The std::pair<uint32_t,T> overload of integerSort passed maxV (not maxV+1) as
the key range to intSort::iSort. iSort represents keys in [0,m) using log2Up(m)
bits; since keys range over [0,maxV], the range must be maxV+1 (as the uint32_t
overload already does). With maxV, the element whose key equals the maximum is
one bit short of representable and lands in the wrong radix bucket whenever maxV
is a power of two, silently breaking sort order (data-dependent). This surfaced
as intermittently-unsorted output from MultiwayMergeHash/SerialMergeHash's
sorted path, which downstream sorted-merge consumers rely on.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Mult_AnXBn_SUMMA3D gains an opt-in sortOutput parameter (default false): when
  true its merges row-sort the output. Default preserves the existing fast
  unsorted behavior; callers feeding the result into a sorted-merge op request
  sorting explicitly. No extra communication -- only local sorts. Both the
  per-layer and fiber merges honor the flag, so the output is sorted at any layer
  count (the fiber merge's nlists==1 fast path would otherwise not sort).
- New EWiseApply overload for SpParMat3D mirroring the 2D EWiseApply API
  (extended form + plain adapter). Combines operands layer-locally (delegating to
  the 2D EWiseApply per layer) with no inter-layer communication. Requires both
  operands in canonical, row-sorted form (2D->3D ctor, Convert2D, or SUMMA3D with
  sortOutput=true).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Verifies the SpParMat3D EWiseApply against the 2D EWiseApply oracle across layer
counts (1/4/16), for both ctor-built operands and a SUMMA3D(sortOutput=true)
product operand. Reuses the rmat_scale16 test data.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- EWiseApply(SpParMat3D): move-construct the local resultant (steal the DCSC tile at O(1))
  instead of deep-copying the layer submatrix.
- SpDCCols: add noexcept move constructor (steal Dcsc ptr, null the source) to support it.
- SpParMat: add SetSeq(DER*) to replace the local sequential block in place (used by HopScotch apps).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant