Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions source/source_pw/module_dfpt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ target_link_libraries(${MODULE_NAME} PUBLIC base cell psi elecstate

if(BUILD_TESTING)
if(ENABLE_MPI)
add_subdirectory(test)
# serial (__MPI-off) tests for the FFT-driving kernels; must be built
# inside ENABLE_MPI so the shared prebuilt test libs stay available
add_subdirectory(test_serial)
# All targets (serial and MPI) live in unittests/; the serial ones are
# built inside ENABLE_MPI so the shared prebuilt test libs stay available
add_subdirectory(unittests)
endif()
endif()
63 changes: 0 additions & 63 deletions source/source_pw/module_dfpt/test/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Consolidated DFPT unit tests (the legacy test_serial/ and test/ directories
# were migrated here per the unittests/ layout rule; the module_stodft move in
# #8334 is the precedent). Target and CTest names are unchanged from the
# legacy layout, so the CI test matrix is unaffected.
#
# Serial targets drive the plane-wave FFT machinery directly (recip2real /
# real2recip on the shared rho/wfc grid). PW_Basis changes its member layout
# under __MPI, so the pw sources linked here must be compiled without __MPI
# in the same translation-unit ABI as the dfpt sources.
abacus_disable_feature_definitions(__MPI)
abacus_disable_feature_definitions(__EXX)
abacus_disable_feature_definitions(__CUDA)
Expand All @@ -6,11 +15,6 @@ abacus_disable_feature_definitions(__ROCM)
abacus_disable_feature_definitions(__UT_USE_ROCM)
abacus_disable_feature_definitions(__MLALGO)

# The DFPT first-order potential kernels (dfpt_pert.cpp) drive the plane-wave
# FFT machinery directly (recip2real / real2recip on the shared rho/wfc grid).
# PW_Basis changes its member layout under __MPI, so the pw sources linked
# here must be compiled without __MPI in the same translation-unit ABI as the
# dfpt sources (mirrors module_pw/test_serial).
add_library(
dfpt_planewave_serial OBJECT
../../../source_base/module_fft/fft_bundle.cpp
Expand All @@ -29,7 +33,7 @@ add_library(
addtest(
TARGET MODULE_DFPT_pert_serial
LIBS parameter dfpt_planewave_serial device base symmetry
SOURCES dfpt_pert_serial_test.cpp
SOURCES test_dfpt_pert.cpp
../dfpt_pert.cpp
../dfpt_pert_vkb.cpp
../dfpt_pert_nl.cpp
Expand All @@ -40,10 +44,10 @@ addtest(
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)

addtest(
TARGET MODULE_DFPT_rho_serial
Expand All @@ -60,10 +64,10 @@ addtest(
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)

addtest(
TARGET MODULE_DFPT_phon_serial
Expand All @@ -88,11 +92,15 @@ addtest(
../../../source_cell/qlist.cpp
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared Ewald neighbor-shell generator (ion_ion real-space sum);
# raw sources because hamilt_general is an MPI-ABI object library
../../../source_hamilt/module_ewald/h_ewald_pw.cpp
../../../source_hamilt/module_ewald/dnrm2.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)

addtest(
TARGET MODULE_DFPT_q0_serial
Expand All @@ -111,10 +119,10 @@ addtest(
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)

# QE-format dyn writer + the Gamma-first q-ordering validation consumed by
# the DFPT driver (test_dfpt_write_dyn.cpp matches dfpt_write_dyn.cpp,
Expand All @@ -130,18 +138,18 @@ addtest(
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)

# Analytic libxc first-order XC kernel (empty TU without libxc, so the test
# only exists when the feature is compiled in)
if(ENABLE_LIBXC)
addtest(
TARGET MODULE_DFPT_xc_analytic_serial
LIBS parameter dfpt_planewave_serial device base symmetry Libxc::xc
SOURCES ../unittests/test_dfpt_xc_analytic.cpp
SOURCES test_dfpt_xc_analytic.cpp
../dfpt_xc_analytic.cpp
../dfpt_rho.cpp
../dfpt_rho_mix.cpp
Expand All @@ -153,8 +161,81 @@ if(ENABLE_LIBXC)
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures
# (see test/dfpt_test_mocks.cpp).
../test/dfpt_test_mocks.cpp
# (see test_dfpt_mocks.cpp).
test_dfpt_mocks.cpp
# Shared serial-side cell/basis/data fixture.
dfpt_test_tool.cpp)
test_dfpt_fixture.cpp)
endif()

# MPI-build targets. The directory disables __MPI for the serial ABI above;
# these targets genuinely exercise the MPI feature, so they opt back in via
# KEEP_FEATURE_DEFINITIONS (see AddTest in cmake/Testing.cmake).
if(ENABLE_MPI)
abacus_disable_feature_definitions(__MLALGO)
abacus_disable_feature_definitions(__CUDA)
abacus_disable_feature_definitions(__ROCM)
abacus_disable_feature_definitions(__EXX)

addtest(
TARGET MODULE_DFPT_pw_data_test
KEEP_FEATURE_DEFINITIONS __MPI
LIBS parameter base device symmetry
SOURCES test_dfpt_pw_data.cpp
../dfpt_pw_data.cpp
../dfpt_pw_data_resp.cpp
../../../source_cell/qlist.cpp
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/Plus_U link closures.
test_dfpt_mocks.cpp
# Shared cubic-cell / stru_lib fixture.
test_dfpt_stru_fixture.cpp)

addtest(
TARGET MODULE_DFPT_kq_basis_test
KEEP_FEATURE_DEFINITIONS __MPI
LIBS parameter base device symmetry planewave
SOURCES test_dfpt_kq_basis.cpp ../dfpt_kq_basis.cpp test_dfpt_mocks.cpp)

addtest(
TARGET MODULE_DFPT_stern_test
KEEP_FEATURE_DEFINITIONS __MPI
LIBS parameter base device symmetry
SOURCES test_dfpt_stern.cpp ../dfpt_stern.cpp test_dfpt_mocks.cpp)

addtest(
TARGET MODULE_DFPT_pw_run_test
KEEP_FEATURE_DEFINITIONS __MPI
LIBS parameter base device symmetry planewave
SOURCES test_dfpt_pw_run.cpp
../dfpt_pw.cpp
../dfpt_pw_init.cpp
../dfpt_pw_run.cpp
../dfpt_pw_solve.cpp
../dfpt_pw_q0.cpp
../dfpt_pw_data.cpp
../dfpt_pw_data_resp.cpp
../dfpt_pert.cpp
../dfpt_pert_vkb.cpp
../dfpt_pert_nl.cpp
../dfpt_kq_basis.cpp
../dfpt_stern.cpp
../dfpt_rho.cpp
../dfpt_rho_mix.cpp
../../../source_estate/module_charge/chg_tools.cpp
../dfpt_phon.cpp
../dfpt_phon_asr.cpp
../dfpt_phon_ewald.cpp
../dfpt_phon_elec.cpp
../dfpt_q0.cpp
../dfpt_q0_pos.cpp
../dfpt_metal.cpp
../dfpt_hamilt_shift.cpp
../../../source_cell/qlist.cpp
../../../source_cell/reciprocal_grid.cpp
../../../source_psi/psi.cpp
# Shared ctor/dtor stubs for the cell/spepot/charge/Plus_U closures.
test_dfpt_mocks.cpp
# Shared cubic-cell / stru_lib fixture.
test_dfpt_stru_fixture.cpp)
endif()
Loading