@@ -226,8 +226,8 @@ void DiagoCG<T, Device>::calc_grad(const ct::Tensor& prec,
226226 // }
227227 // denghui replace this at 20221106
228228 // TODO: use GPU precondition to initialize CG class
229- vector_div_vector_op<T, Device>()(ctx_, this ->n_basis_ , grad.data <T>(), hphi.data <T>(), prec.data <Real>());
230- vector_div_vector_op<T, Device>()(ctx_, this ->n_basis_ , pphi.data <T>(), sphi.data <T>(), prec.data <Real>());
229+ ModuleBase:: vector_div_vector_op<T, Device>()(ctx_, this ->n_basis_ , grad.data <T>(), hphi.data <T>(), prec.data <Real>());
230+ ModuleBase:: vector_div_vector_op<T, Device>()(ctx_, this ->n_basis_ , pphi.data <T>(), sphi.data <T>(), prec.data <Real>());
231231
232232 // Update lambda !
233233 // (4) <psi|SPH|psi >
@@ -247,13 +247,13 @@ void DiagoCG<T, Device>::calc_grad(const ct::Tensor& prec,
247247 // grad.data<T>()[i] -= lambda * this->pphi[i];
248248 // }
249249 // haozhihan replace this 2022-10-6
250- constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
251- this ->n_basis_ ,
252- grad.data <T>(),
253- grad.data <T>(),
254- 1.0 ,
255- pphi.data <T>(),
256- (-lambda));
250+ ModuleBase:: constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
251+ this ->n_basis_ ,
252+ grad.data <T>(),
253+ grad.data <T>(),
254+ 1.0 ,
255+ pphi.data <T>(),
256+ (-lambda));
257257}
258258
259259template <typename T, typename Device>
@@ -264,49 +264,49 @@ void DiagoCG<T, Device>::orth_grad(const ct::Tensor& psi,
264264 ct::Tensor& lagrange)
265265{
266266 this ->spsi_func_ (grad, scg); // scg = S|grad>
267- gemv_op<T, Device>()(ctx_,
268- ' C' ,
269- this ->n_basis_ ,
270- m,
271- this ->one_ ,
272- psi.data <T>(),
273- this ->n_basis_ ,
274- scg.data <T>(),
275- 1 ,
276- this ->zero_ ,
277- lagrange.data <T>(),
278- 1 );
267+ ModuleBase:: gemv_op<T, Device>()(ctx_,
268+ ' C' ,
269+ this ->n_basis_ ,
270+ m,
271+ this ->one_ ,
272+ psi.data <T>(),
273+ this ->n_basis_ ,
274+ scg.data <T>(),
275+ 1 ,
276+ this ->zero_ ,
277+ lagrange.data <T>(),
278+ 1 );
279279
280280 Parallel_Reduce::reduce_pool (lagrange.data <T>(), m);
281281
282282 // (3) orthogonal |g> and |scg> to all states (0~m-1)
283283 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
284284 // haozhihan replace 2022-10-07
285- gemv_op<T, Device>()(ctx_,
286- ' N' ,
287- this ->n_basis_ ,
288- m,
289- this ->neg_one_ ,
290- psi.data <T>(),
291- this ->n_basis_ ,
292- lagrange.data <T>(),
293- 1 ,
294- this ->one_ ,
295- grad.data <T>(),
296- 1 );
297-
298- gemv_op<T, Device>()(ctx_,
299- ' N' ,
300- this ->n_basis_ ,
301- m,
302- this ->neg_one_ ,
303- psi.data <T>(),
304- this ->n_basis_ ,
305- lagrange.data <T>(),
306- 1 ,
307- this ->one_ ,
308- scg.data <T>(),
309- 1 );
285+ ModuleBase:: gemv_op<T, Device>()(ctx_,
286+ ' N' ,
287+ this ->n_basis_ ,
288+ m,
289+ this ->neg_one_ ,
290+ psi.data <T>(),
291+ this ->n_basis_ ,
292+ lagrange.data <T>(),
293+ 1 ,
294+ this ->one_ ,
295+ grad.data <T>(),
296+ 1 );
297+
298+ ModuleBase:: gemv_op<T, Device>()(ctx_,
299+ ' N' ,
300+ this ->n_basis_ ,
301+ m,
302+ this ->neg_one_ ,
303+ psi.data <T>(),
304+ this ->n_basis_ ,
305+ lagrange.data <T>(),
306+ 1 ,
307+ this ->one_ ,
308+ scg.data <T>(),
309+ 1 );
310310}
311311
312312template <typename T, typename Device>
@@ -342,7 +342,7 @@ void DiagoCG<T, Device>::calc_gamma_cg(const int& iter,
342342 // }
343343 // denghui replace this 20221106
344344 // TODO: use GPU precondition instead
345- vector_mul_vector_op<T, Device>()(ctx_, this ->n_basis_ , g0.data <T>(), scg.data <T>(), prec.data <Real>());
345+ ModuleBase:: vector_mul_vector_op<T, Device>()(ctx_, this ->n_basis_ , g0.data <T>(), scg.data <T>(), prec.data <Real>());
346346
347347 // (3) Update gg_now!
348348 // gg_now = < g|P|scg > = < g|g0 >
@@ -370,13 +370,13 @@ void DiagoCG<T, Device>::calc_gamma_cg(const int& iter,
370370 // pcg[i] = gamma * pcg[i] + grad.data<T>()[i];
371371 // }
372372 // haozhihan replace this 2022-10-6
373- constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
374- this ->n_basis_ ,
375- cg.data <T>(),
376- cg.data <T>(),
377- gamma,
378- grad.data <T>(),
379- 1.0 );
373+ ModuleBase:: constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
374+ this ->n_basis_ ,
375+ cg.data <T>(),
376+ cg.data <T>(),
377+ gamma,
378+ grad.data <T>(),
379+ 1.0 );
380380
381381 const Real norma = gamma * cg_norm * sin (theta);
382382 T znorma = static_cast <T>(norma * -1 );
@@ -388,7 +388,7 @@ void DiagoCG<T, Device>::calc_gamma_cg(const int& iter,
388388 {
389389 pcg[i] -= norma * pphi_m[i];
390390 }*/
391- axpy_op<T, Device>()(ctx_, this ->n_basis_ , &znorma, phi_m.data <T>(), 1 , cg.data <T>(), 1 );
391+ ModuleBase:: axpy_op<T, Device>()(ctx_, this ->n_basis_ , &znorma, phi_m.data <T>(), 1 , cg.data <T>(), 1 );
392392 }
393393}
394394
@@ -438,13 +438,13 @@ bool DiagoCG<T, Device>::update_psi(const ct::Tensor& pphi,
438438 // }
439439
440440 // haozhihan replace this 2022-10-6
441- constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
442- this ->n_basis_ ,
443- phi_m.data <T>(),
444- phi_m.data <T>(),
445- cost,
446- cg.data <T>(),
447- sint_norm);
441+ ModuleBase:: constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
442+ this ->n_basis_ ,
443+ phi_m.data <T>(),
444+ phi_m.data <T>(),
445+ cost,
446+ cg.data <T>(),
447+ sint_norm);
448448
449449 if (std::abs (eigen - e0 ) < ethreshold)
450450 {
@@ -460,20 +460,20 @@ bool DiagoCG<T, Device>::update_psi(const ct::Tensor& pphi,
460460 // }
461461
462462 // haozhihan replace this 2022-10-6
463- constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
464- this ->n_basis_ ,
465- sphi.data <T>(),
466- sphi.data <T>(),
467- cost,
468- scg.data <T>(),
469- sint_norm);
470- constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
471- this ->n_basis_ ,
472- hphi.data <T>(),
473- hphi.data <T>(),
474- cost,
475- pphi.data <T>(),
476- sint_norm);
463+ ModuleBase:: constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
464+ this ->n_basis_ ,
465+ sphi.data <T>(),
466+ sphi.data <T>(),
467+ cost,
468+ scg.data <T>(),
469+ sint_norm);
470+ ModuleBase:: constantvector_addORsub_constantVector_op<T, Device>()(ctx_,
471+ this ->n_basis_ ,
472+ hphi.data <T>(),
473+ hphi.data <T>(),
474+ cost,
475+ pphi.data <T>(),
476+ sint_norm);
477477 return false ;
478478 }
479479}
@@ -496,36 +496,36 @@ void DiagoCG<T, Device>::schmit_orth(const int& m, const ct::Tensor& psi, const
496496 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
497497 // haozhihan replace 2022-10-6
498498 int inc = 1 ;
499- gemv_op<T, Device>()(ctx_,
500- ' C' ,
501- this ->n_basis_ ,
502- m + 1 ,
503- this ->one_ ,
504- psi.data <T>(),
505- this ->n_basis_ ,
506- sphi.data <T>(),
507- inc,
508- this ->zero_ ,
509- lagrange_so.data <T>(),
510- inc);
499+ ModuleBase:: gemv_op<T, Device>()(ctx_,
500+ ' C' ,
501+ this ->n_basis_ ,
502+ m + 1 ,
503+ this ->one_ ,
504+ psi.data <T>(),
505+ this ->n_basis_ ,
506+ sphi.data <T>(),
507+ inc,
508+ this ->zero_ ,
509+ lagrange_so.data <T>(),
510+ inc);
511511
512512 // be careful , here reduce m+1
513513 Parallel_Reduce::reduce_pool (lagrange_so.data <T>(), m + 1 );
514514
515515 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
516516 // haozhihan replace 2022-10-6
517- gemv_op<T, Device>()(ctx_,
518- ' N' ,
519- this ->n_basis_ ,
520- m,
521- this ->neg_one_ ,
522- psi.data <T>(),
523- this ->n_basis_ ,
524- lagrange_so.data <T>(),
525- inc,
526- this ->one_ ,
527- phi_m.data <T>(),
528- inc);
517+ ModuleBase:: gemv_op<T, Device>()(ctx_,
518+ ' N' ,
519+ this ->n_basis_ ,
520+ m,
521+ this ->neg_one_ ,
522+ psi.data <T>(),
523+ this ->n_basis_ ,
524+ lagrange_so.data <T>(),
525+ inc,
526+ this ->one_ ,
527+ phi_m.data <T>(),
528+ inc);
529529
530530 // ======================================================================
531531 /* for (int j = 0; j < m; j++)
@@ -563,7 +563,7 @@ void DiagoCG<T, Device>::schmit_orth(const int& m, const ct::Tensor& psi, const
563563 // {
564564 // pphi_m[ig] /= psi_norm;
565565 // }
566- vector_div_constant_op<T, Device>()(ctx_, this ->n_basis_ , phi_m.data <T>(), phi_m.data <T>(), psi_norm);
566+ ModuleBase:: vector_div_constant_op<T, Device>()(ctx_, this ->n_basis_ , phi_m.data <T>(), phi_m.data <T>(), psi_norm);
567567
568568 // ModuleBase::timer::tick("DiagoCG","schmit_orth");
569569}
0 commit comments