Skip to content

1. fix filter_atom in cal_loop3_GPU() - #24

Merged
PeizeLin merged 0 commit into
abacusmodeling:masterfrom
PeizeLin:symmetry_GPU_2
Nov 23, 2026
Merged

PeizeLin merged 0 commit into
abacusmodeling:masterfrom
PeizeLin:symmetry_GPU_2

Conversation

@PeizeLin

Copy link
Copy Markdown
Contributor

No description provided.

@Stardust0831 Stardust0831 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested d8fc6eca97f6ccf0b4448644f2f891ad7f2eb2e9 on one V100 (one MPI rank, OMP/BLAS=1). This fixes four of the eight previously failing GPU symmetry labels; the remaining intermediate-filter issue is identified inline.

Please also update unittests/gpu_symmetry/test_lri_gpu_symmetry.cpp to include Filter_Atom_Symmetry_Wrapper.h after LRI.h, and construct:

lri.filter_atom = std::make_shared<RI::Filter_Atom_Symmetry_Wrapper<int, Cell, T>>(
    period, sector, lri.cal_mode);

The current fixture directly constructs the CPU filter, so its GPU path does not exercise the intended filter implementation. The Wrapper keeps a reference to lri.cal_mode, matching the existing backend-switching loop. Fixture patch.

Report and exact failures · Reproduction sources/scripts · Raw build/run logs. The 456-check result is standalone LibRI validation; application-level symmetry acceptance remains outstanding.

Comment thread tools/cal_loop3/cal_loop3_GPU.py Outdated
{{
const TAC &Ab01 = list_Ab01[ib01];
if(this->filter_atom->filter_for32(label, Aa01, Ab01, Aa2)) continue;
if(this->filter_atom->filter_for32(label, Aa01, Aa2, Ab01)) continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The corrected argument order is needed, but the preceding filter_for2(label,Aa01,Aa2) at line 838 still discards required terms. Here Aa2 is a summation index; for this label family the GPU filter interprets (Aa01,Aa2) as an output pair. Please remove that intermediate-stage call and retain this filter_for32, which screens the actual output pair (Aa01,Ab01):

-                        if(this->filter_atom->filter_for2(label,Aa01,Aa2)) continue;

Regenerating LRI-cal_loop3_GPU.hpp then removes the corresponding four calls. Keep filter_for2 at the final output stage. The tested patch changes only this generator line and the four generated lines; regeneration reproduces the tested header exactly.

On one V100, with the Wrapper fixture, this PR still fails a1b2_a2b1, a1b2_a2b0, a0b2_a2b1, and a0b2_a2b0 for both real and complex tensors, plus the combined sum. Applying that small deletion on top passes all 456 CHECK / 38 PASS, with the original reference and tolerance unchanged.

@Stardust0831 Stardust0831 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the update! I retested 39c953b on one V100 with one MPI rank. The original LibRI regression suite (456 CHECK / 38 PASS) and the 20-run ABACUS HSE validation both passed, including cases with nonzero forces. The CPU/GPU RI and real-space symmetry on/off comparisons all passed as well. I could no longer reproduce the issues I reported earlier in these tests.

@PeizeLin
PeizeLin merged commit 1a2ee2b into abacusmodeling:master Nov 23, 2026
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