Skip to content

Commit 859b9ec

Browse files
committed
Remove finalize code out
1 parent 21d1e9c commit 859b9ec

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,6 @@ ESolver_KS_PW<T, Device>::~ESolver_KS_PW()
7171
this->pelec = nullptr;
7272
}
7373

74-
if (this->device == base_device::GpuDevice)
75-
{
76-
#if defined(__CUDA) || defined(__ROCM)
77-
ModuleBase::destoryBLAShandle();
78-
hsolver::destroyGpuSolverHandle();
79-
container::kernels::destroyGpuBlasHandle();
80-
container::kernels::destroyGpuSolverHandle();
81-
#endif
82-
}
83-
84-
#ifdef __DSP
85-
std::cout << " ** Closing DSP Hardware..." << std::endl;
86-
mtfunc::dspDestoryHandle(GlobalV::MY_RANK);
87-
#endif
88-
8974
if (PARAM.inp.device == "gpu" || PARAM.inp.precision == "single")
9075
{
9176
delete this->kspw_psi;

source/source_main/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Driver
4040

4141
// Init harewares according to Input parameters
4242
void init_hardware();
43+
void finalize_hardware();
4344
};
4445

4546
#endif

source/source_main/driver_run.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,16 @@ void Driver::driver_run()
106106
p_esolver->after_all_runners(ucell);
107107

108108
ModuleESolver::clean_esolver(p_esolver);
109+
this->finalize_hardware();
109110

110111
//! 6: output the json file
111112
Json::create_Json(&ucell, PARAM);
112113

113114
return;
114115
}
115116

116-
void Driver::init_hardware(){
117+
void Driver::init_hardware()
118+
{
117119
#if ((defined __CUDA) || (defined __ROCM))
118120
if (PARAM.inp.device == "gpu")
119121
{
@@ -129,3 +131,21 @@ void Driver::init_hardware(){
129131
mtfunc::dspInitHandle(GlobalV::MY_RANK);
130132
#endif
131133
}
134+
135+
void Driver::finalize_hardware()
136+
{
137+
#if defined(__CUDA) || defined(__ROCM)
138+
if (PARAM.inp.device == "gpu")
139+
{
140+
ModuleBase::destoryBLAShandle();
141+
hsolver::destroyGpuSolverHandle();
142+
container::kernels::destroyGpuBlasHandle();
143+
container::kernels::destroyGpuSolverHandle();
144+
}
145+
#endif
146+
147+
#ifdef __DSP
148+
std::cout << " ** Closing DSP Hardware..." << std::endl;
149+
mtfunc::dspDestoryHandle(GlobalV::MY_RANK);
150+
#endif
151+
}

0 commit comments

Comments
 (0)