Commit 71c01230 by Francois Gygi

Added timers


git-svn-id: http://qboxcode.org/svn/qb/trunk@1788 cba15fb0-1239-40c8-b417-11db7ca47a34
parent c8456e03
......@@ -364,10 +364,14 @@ void BOSampleStepper::step(int niter)
cd_.update_density();
tmap["charge"].stop();
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
const bool compute_forces = true;
tmap["energy"].start();
double energy =
ef_.energy(false,dwf,compute_forces,fion,compute_stress,sigma_eks);
tmap["energy"].stop();
double enthalpy = ef_.enthalpy();
if ( onpe0 )
......@@ -461,7 +465,9 @@ void BOSampleStepper::step(int niter)
if ( compute_stress )
{
tmap["compute_sigma"].start();
compute_sigma();
tmap["compute_sigma"].stop();
print_stress();
if ( cell_moves )
......@@ -806,7 +812,9 @@ void BOSampleStepper::step(int niter)
}
} // if nite_ > 0
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
// reset stepper only if multiple non-selfconsistent steps
if ( nite_ > 0 ) wf_stepper->preprocess();
......@@ -833,7 +841,9 @@ void BOSampleStepper::step(int niter)
//
while ( !nonscf_converged && ite < max(nite_,1) )
{
tmap["energy"].start();
energy = ef_.energy(true,dwf,false,fion,false,sigma_eks);
tmap["energy"].stop();
// compute the sum of eigenvalues (with fixed weight)
// to measure convergence of the subspace update
......@@ -850,7 +860,9 @@ void BOSampleStepper::step(int niter)
cout << " <eigenvalue_sum> "
<< eigenvalue_sum << " </eigenvalue_sum>" << endl;
tmap["wf_update"].start();
wf_stepper->update(dwf);
tmap["wf_update"].stop();
// compare delta_eig_sum only after first iteration
if ( ite > 0 )
......@@ -873,8 +885,12 @@ void BOSampleStepper::step(int niter)
// subspace diagonalization
if ( compute_eigvec || s_.ctrl.wf_diag == "EIGVAL" )
{
tmap["energy"].start();
ef_.energy(true,dwf,false,fion,false,sigma_eks);
tmap["energy"].stop();
tmap["wfdiag"].start();
s_.wf.diag(dwf,compute_eigvec);
tmap["wfdiag"].stop();
if ( onpe0 )
{
cout << "<eigenset>" << endl;
......@@ -977,6 +993,7 @@ void BOSampleStepper::step(int niter)
if ( compute_mlwf || compute_mlwfc )
{
tmap["mlwf"].start();
for ( int ispin = 0; ispin < nspin; ispin++ )
{
mlwft[ispin]->update();
......@@ -1046,6 +1063,7 @@ void BOSampleStepper::step(int niter)
<< " </total_dipole_length>" << endl;
cout << "</mlwfs>" << endl;
}
tmap["mlwf"].stop();
}
// If GS calculation only, print energy and atomset at end of iterations
......@@ -1055,9 +1073,13 @@ void BOSampleStepper::step(int niter)
cd_.update_density();
tmap["charge"].stop();
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
const bool compute_forces = true;
tmap["energy"].start();
ef_.energy(false,dwf,compute_forces,fion,compute_stress,sigma_eks);
tmap["energy"].stop();
if ( onpe0 )
{
......@@ -1104,7 +1126,9 @@ void BOSampleStepper::step(int niter)
<< atoms.cell().volume() << " </unit_cell_volume>" << endl;
if ( compute_stress )
{
tmap["compute_sigma"].start();
compute_sigma();
tmap["compute_sigma"].stop();
print_stress();
}
}
......@@ -1118,8 +1142,12 @@ void BOSampleStepper::step(int niter)
tmap["charge"].start();
cd_.update_density();
tmap["charge"].stop();
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
tmap["energy"].start();
ef_.energy(true,dwf,false,fion,false,sigma_eks);
tmap["energy"].stop();
if ( onpe0 )
{
cout << ef_;
......@@ -1167,10 +1195,14 @@ void BOSampleStepper::step(int niter)
cd_.update_density();
tmap["charge"].stop();
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
const bool compute_forces = true;
tmap["energy"].start();
double energy =
ef_.energy(false,dwf,compute_forces,fion,compute_stress,sigma_eks);
tmap["energy"].stop();
ionic_stepper->compute_v(energy,fion);
// positions r0 and velocities v0 are consistent
......@@ -1181,7 +1213,9 @@ void BOSampleStepper::step(int niter)
// compute wavefunction velocity after last iteration
// s_.wfv contains the previous wavefunction
tmap["align"].start();
s_.wfv->align(s_.wf);
tmap["align"].stop();
for ( int ispin = 0; ispin < s_.wf.nspin(); ispin++ )
{
......@@ -1227,10 +1261,14 @@ void BOSampleStepper::step(int niter)
cd_.update_density();
tmap["charge"].stop();
tmap["update_vhxc"].start();
ef_.update_vhxc(compute_stress);
tmap["update_vhxc"].stop();
const bool compute_forces = true;
tmap["energy"].start();
double energy =
ef_.energy(false,dwf,compute_forces,fion,compute_stress,sigma_eks);
tmap["energy"].stop();
ionic_stepper->compute_v(energy,fion);
// positions r0 and velocities v0 are consistent
......
......@@ -215,45 +215,67 @@ void JDWavefunctionStepper::update(Wavefunction& dwf)
// (Y,HY)
// factor 2.0 in next line: G and -G
tmap_["jd_gemm"].start();
a.gemm('t','n',2.0,c_proxy_t,cp_proxy_t,0.0);
tmap_["jd_gemm"].stop();
// rank-1 update correction
a.ger(-1.0,c_proxy_t,0,cp_proxy_t,0);
// a contains (Y,HY), copy to h11 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,0,0);
tmap_["jd_getsub"].stop();
// (Z,HY)
// factor 2.0 in next line: G and -G
tmap_["jd_gemm"].start();
a.gemm('t','n',2.0,c_proxy,cp_proxy_t,0.0);
tmap_["jd_gemm"].stop();
// rank-1 update correction
a.ger(-1.0,c_proxy,0,cp_proxy_t,0);
// a contains (Z,HY), copy to h21 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,a.m(),0);
tmap_["jd_getsub"].stop();
// (Z,HZ)
// factor 2.0 in next line: G and -G
tmap_["jd_gemm"].start();
a.gemm('t','n',2.0,c_proxy,cp_proxy,0.0);
tmap_["jd_gemm"].stop();
// rank-1 update correction
a.ger(-1.0,c_proxy,0,cp_proxy,0);
// a contains (Z,HZ), copy to h22 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,a.m(),a.n());
tmap_["jd_getsub"].stop();
// diagonalize h
// Note: we only need the first n eigenvectors of the (2n x 2n) matrix
valarray<double> w(h.m());
// q is (2n,2n)
DoubleMatrix q(h.context(),h.n(),h.n(),h.nb(),h.nb());
tmap_["jd_syev"].start();
h.syev('l',w,q);
tmap_["jd_syev"].stop();
// compute the first n eigenvectors and store in wf
// Y = Z Q21 (store result in dwf)
// get Q21 in a
tmap_["jd_getsub"].start();
a.getsub(q,a.n(),a.n(),a.n(),0);
tmap_["jd_getsub"].stop();
tmap_["jd_gemm"].start();
cp_proxy.gemm('n','n',1.0,c_proxy,a,0.0);
tmap_["jd_gemm"].stop();
// Y = Y Q11 (store result in wf)
// get Q11 in a
tmap_["jd_getsub"].start();
a.getsub(q,a.n(),a.n(),0,0);
tmap_["jd_getsub"].stop();
tmap_["jd_gemm"].start();
c_proxy.gemm('n','n',1.0,c_proxy_t,a,0.0);
tmap_["jd_gemm"].stop();
// add two contributions
c_proxy += cp_proxy;
......@@ -276,37 +298,59 @@ void JDWavefunctionStepper::update(Wavefunction& dwf)
// (Y,HY)
// factor 2.0 in next line: G and -G
tmap_["jd_gemm"].start();
a.gemm('c','n',1.0,ct,cpt,0.0);
tmap_["jd_gemm"].stop();
// a contains (Y,HY), copy to h11 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,0,0);
tmap_["jd_getsub"].stop();
// (Z,HY)
tmap_["jd_gemm"].start();
a.gemm('c','n',1.0,c,cpt,0.0);
tmap_["jd_gemm"].stop();
// a contains (Z,HY), copy to h21 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,a.m(),0);
tmap_["jd_getsub"].stop();
// (Z,HZ)
tmap_["jd_gemm"].start();
a.gemm('c','n',1.0,c,cp,0.0);
tmap_["jd_gemm"].stop();
// a contains (Z,HZ), copy to h22 block
tmap_["jd_getsub"].start();
h.getsub(a,a.m(),a.n(),0,0,a.m(),a.n());
tmap_["jd_getsub"].stop();
// diagonalize h
// Note: we only need the first n eigenvectors of the (2n x 2n) matrix
valarray<double> w(h.m());
// q is (2n,2n)
ComplexMatrix q(h.context(),h.n(),h.n(),h.nb(),h.nb());
tmap_["jd_heev"].start();
h.heev('l',w,q);
tmap_["jd_heev"].stop();
// compute the first n eigenvectors and store in wf
// Y = Z Q21 (store result in dwf)
// get Q21 in a
tmap_["jd_getsub"].start();
a.getsub(q,a.n(),a.n(),a.n(),0);
tmap_["jd_getsub"].stop();
tmap_["jd_gemm"].start();
cp.gemm('n','n',1.0,c,a,0.0);
tmap_["jd_gemm"].stop();
// Y = Y Q11 (store result in wf)
// get Q11 in a
tmap_["jd_getsub"].start();
a.getsub(q,a.n(),a.n(),0,0);
tmap_["jd_getsub"].stop();
tmap_["jd_gemm"].start();
c.gemm('n','n',1.0,ct,a,0.0);
tmap_["jd_getsub"].stop();
// add two contributions
c += cp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment