Skip to content

Commit fa35f83

Browse files
mohanchenabacus_fixer
andauthored
Migrate exx_info (#6896)
* Refactor: Encapsulate timer functionality in timer_wrapper.h * Refactor timer code and clean_esolver function 1. Remove #ifdef __MPI from timer code, encapsulate in timer_wrapper.h 2. Move ESolver clean logic to after_all_runners method 3. Replace clean_esolver calls with direct delete p_esolver 4. Remove #ifdef __MPI from delete p_esolver 5. Add Cblacs_exit(1) in after_all_runners for LCAO calculations * Refactor: Move heterogeneous parallel code to source_base/module_device * Refactor heterogeneous parallel code and migrate exx_info to module_xc 1. Refactor global.h: - Removed heterogeneous parallel code (CUDA/ROCm error checking macros) - Added include for source_base/module_device/device_check.h - Removed GlobalC::exx_info declaration 2. Migrate exx_info: - Added GlobalC::exx_info declaration to exx_info.h - Created exx_info.cpp with GlobalC::exx_info definition - Removed exx_info definition from global.cpp - Removed duplicate exx_info definition from exx_helper.cpp 3. Update build system: - Added exx_info.cpp to xc_ library in CMakeLists.txt - Added exx_info.o to OBJS_XC in Makefile.Objects - Fixed formatting in Makefile.Objects 4. Ensure compatibility: - Verify pure PW compilation works with exx_info.cpp - Verify GPU compilation works with refactored code This refactoring improves code modularity by separating heterogeneous parallel functionality from global variables and moving EXX-related global variables to their own module. --------- Co-authored-by: abacus_fixer <mohanchen@pku.eud.cn>
1 parent 0c8b6dc commit fa35f83

7 files changed

Lines changed: 19 additions & 16 deletions

File tree

source/Makefile.Objects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ OBJS_XC=xc_functional.o\
510510
xc_funct_exch_gga.o\
511511
xc_funct_corr_gga.o\
512512
xc_funct_hcth.o\
513+
exx_info.o\
513514

514515
OBJS_IO=input_conv.o\
515516
berryphase.o\

source/source_hamilt/module_xc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ add_library(
1717
xc_functional_libxc_wrapper_xc.cpp
1818
xc_functional_libxc_wrapper_gcxc.cpp
1919
xc_functional_libxc_wrapper_tauxc.cpp
20+
exx_info.cpp
2021
)
2122

2223
if(ENABLE_COVERAGE)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "exx_info.h"
2+
3+
//----------------------------------------------------------
4+
// init "GLOBAL CLASS" object
5+
//----------------------------------------------------------
6+
namespace GlobalC
7+
{
8+
Exx_Info exx_info;
9+
}

source/source_hamilt/module_xc/exx_info.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,12 @@ struct Exx_Info
9595
}
9696
};
9797

98+
//==========================================================
99+
// EXPLAIN : define "GLOBAL CLASS"
100+
//==========================================================
101+
namespace GlobalC
102+
{
103+
extern Exx_Info exx_info;
104+
} // namespace GlobalC
105+
98106
#endif

source/source_pw/module_pwdft/global.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
//----------------------------------------------------------
55
namespace GlobalC
66
{
7-
#ifdef __EXX
8-
Exx_Info exx_info;
9-
#endif
107
Restart restart; // Peize Lin add 2020.04.04
118
}
129

source/source_pw/module_pwdft/global.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
//==========================================================
1919
// EXPLAIN : define "GLOBAL CLASS"
2020
//==========================================================
21-
namespace GlobalC
22-
{
23-
//#ifdef __EXX
24-
extern Exx_Info exx_info;
25-
//#endif
26-
} // namespace GlobalC
2721

2822
#include "source_cell/parallel_kpoints.h"
2923
#include "source_cell/unitcell.h"

source/source_pw/module_pwdft/module_exx_helper/exx_helper.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,3 @@ template class Exx_Helper<std::complex<float>, base_device::DEVICE_GPU>;
5757
template class Exx_Helper<std::complex<double>, base_device::DEVICE_GPU>;
5858
#endif
5959

60-
#ifndef __EXX
61-
#include "source_hamilt/module_xc/exx_info.h"
62-
namespace GlobalC
63-
{
64-
Exx_Info exx_info;
65-
}
66-
#endif

0 commit comments

Comments
 (0)