Skip to content

Commit 7855e11

Browse files
committed
add duration test
1 parent cf7d9de commit 7855e11

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/module_lr/potentials/xc_kernel.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
#include "module_lr/utils/lr_util.h"
66
#include "module_lr/utils/lr_util_xc.hpp"
77
#include <set>
8+
#include <chrono>
89
#include "module_io/cube_io.h"
910
#ifdef USE_LIBXC
1011
#include <xc.h>
1112
#include "module_hamilt_general/module_xc/xc_functional_libxc.h"
1213
#endif
14+
#ifdef _OPENMP
15+
#include <omp.h>
16+
#endif
1317

1418
LR::KernelXC::KernelXC(const ModulePW::PW_Basis& rho_basis,
1519
const UnitCell& ucell,
@@ -192,15 +196,19 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
192196
{
193197
assert(src.size() == dst.size());
194198
#ifdef _OPENMP
195-
#pragma omp parallel for
199+
#pragma omp parallel for schedule(static, 4096)
196200
#endif
197201
for (size_t i = 0; i < src.size(); ++i) { dst[i] += src[i]; }
198202
};
203+
// auto start = std::chrono::high_resolution_clock::now();
199204
omp_add_vector(vrho_tmp, this->vrho_);
200205
omp_add_vector(v2rho2_tmp, this->v2rho2_);
201206
omp_add_vector(vsigma_tmp, this->vsigma_);
202207
omp_add_vector(v2rhosigma_tmp, this->v2rhosigma_);
203208
omp_add_vector(v2sigma2_tmp, this->v2sigma2_);
209+
// auto end = std::chrono::high_resolution_clock::now();
210+
// auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
211+
// std::cout << "Time elapsed adding XC components: " << duration.count() << " ms\n";
204212
} // end for( xc_func_type &func : funcs )
205213

206214
XC_Functional_Libxc::finish_func(funcs);
@@ -216,7 +224,6 @@ void LR::KernelXC::f_xc_libxc(const int& nspin, const double& omega, const doubl
216224

217225
if (1 == nspin)
218226
{
219-
using V3 = ModuleBase::Vector3<double>;
220227
// 0. drho
221228
this->drho_gs_ = gradrho[0];
222229
// 1. $2f^{\rho\sigma}*\nabla\rho$

0 commit comments

Comments
 (0)