test(base): expand source_base unit-test coverage - #7888
Open
Critsium-xy wants to merge 15 commits into
Open
Conversation
added 10 commits
September 1, 2026 15:58
- lapack_test Potrf: the test previously read B.data<Type>() on the host after B had been moved to the device via to_device<Device>(). Since base::utils::Types includes DEVICE_GPU tuples under __CUDA/__ROCM, this dereferenced device memory from host code. Copy back to the CPU before inspecting elements. - lapack_test GetrfGetriGetrs: the test passed host stack arrays to lapack_getrf/getrs/getri instantiated with the TypeParam device. The cuSolver variants are explicitly instantiated, so a CUDA build linked and then received host pointers at runtime. Pin the test to DEVICE_CPU, matching the Trtri test. - TensorBuffer::operator=(const TensorBuffer&): the allocator was deleted unconditionally but only reassigned for CpuDevice/GpuDevice. A moved-from buffer (now nulled by the move ctor/assignment) or a non-owning TensorBuffer(void*) reports DeviceType::UnKnown, so the following allocate() call dereferenced the freed allocator. Reset the buffer state and bail out for that case. - math_erf_complex_test: the conjugate-symmetry check used an absolute 1e-11 tolerance on samples reaching |erf(z)| ~ 7e60, which demands bit-exact agreement and is sensitive to libm and FP contraction. Scale the tolerance with the magnitude of the expected value. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHKnX7j7yhrvgAEMAUY1uH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
No linked issue. This is a focused source_base coverage and decoupling follow-up.
Unit Tests and/or Case Tests for my changes
OMP_NUM_THREADS=1 ctest --test-dir /tmp/abacus-source-base-coverage --output-on-failure --timeout 1700 -R "^MODULE_BASE"OMP_NUM_THREADS=1 ctest --test-dir /tmp/abacus-source-base-coverage --output-on-failure -R "^MODULE_IO_(output_test|orb_io_test|orb_io_test_parallel|write_wfc_nao|read_exit_file_test)$"OMP_NUM_THREADS=1 ctest --test-dir /tmp/abacus-source-base-coverage --output-on-failure -R "^MODULE_BASE_(parallel_reduce_test|parallel_device|parallel_device_parallel)$"/tmp/abacus-source-base-coverage, restricted to production files undersource/source_base.developatc2fa3ac19:cmake -S . -B build-pr7888 -G Ninja -DBUILD_TESTING=ON -DENABLE_MPI=ON -DCMAKE_BUILD_TYPE=Debugcmake --build build-pr7888 --target MODULE_BASE_para_gemm MODULE_BASE_parallel_device MODULE_BASE_parallel_domain_grid -j4OMP_NUM_THREADS=1 ctest --test-dir build-pr7888 --output-on-failure -R '^MODULE_BASE_(para_gemm|para_gemm_parallel|parallel_device|parallel_device_parallel|parallel_domain_grid|parallel_domain_grid_parallel)$'OMP_NUM_THREADS=1 ctest --test-dir build-pr7888 --output-on-failure -R '^MODULE_BASE' -j4clang-format --dry-run --Werror source/source_base/test_parallel/parallel_device_test.cpp source/source_base/test_parallel/parallel_domain_grid_test.cpp source/source_base/test_parallel/test_para_gemm.cpppython3 tools/03_code_analysis/agent_governance_check.py --base upstream/develop --head HEAD --format textpython3 tools/03_code_analysis/code_quality_score.py $(git diff --name-only upstream/develop...HEAD | grep -E '\.(cpp|h)$')git diff --check upstream/develop...HEADdevelopatc2fa3ac19, including all affected serial and four-process MPI tests.MODULE_BASE_LIBM_UTspassed in a separateENABLE_ABACUS_LIBM=ONtargeted configuration.clang-format --dry-run --Werrorover every touched legacy file reports existing formatting differences. New standalone tests and directly formatted files pass targeted formatting checks; this PR intentionally avoids unrelated repository-wide formatting churn.MODULE_BASEtargets were built, installed with their test assets, and the complete MODULE_BASE test selection passed.What changed?
set_memory<T, DEVICE_GPU>stub signature to match its declared interface.TensorBuffermove ownership transfer to clear the moved-from allocator and prevent double deletion; also keeps allocated-byte accounting correct after resize/copy/move assignment.developand migrated the added parallel tests from the removedcommunication_domain.h/size()API toparallel_cell.hand the existingMPICommGroupwrapper.Governance Notes
docs/parameters.yamlanddocs/advanced/input_files/input-main.mddo not require updates.MPICommGroupwrapper and adds no direct MPI routine calls.