Skip to content

Commit 0fde07e

Browse files
committed
fix compile
1 parent e58bfe0 commit 0fde07e

File tree

6 files changed

+463
-467
lines changed

6 files changed

+463
-467
lines changed

source/module_base/para_gemm.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ template <typename T, typename Device>
7575
void PGemmCN<T, Device>::multiply(const T alpha, const T* A, const T* B, const T beta, T* C_global)
7676
{
7777
const Device* ctx = {};
78-
char transC = 'C';
79-
char transN = 'N';
8078
#ifdef __MPI
8179
if (col_nproc > 1)
8280
{
@@ -122,8 +120,8 @@ void PGemmCN<T, Device>::multiply(const T alpha, const T* A, const T* B, const T
122120
if (col_rank == ip)
123121
{
124122
ModuleBase::gemm_op<T, Device>()(ctx,
125-
transC,
126-
transN,
123+
'C',
124+
'N',
127125
ncolA,
128126
ncolB,
129127
nrow,
@@ -145,8 +143,8 @@ void PGemmCN<T, Device>::multiply(const T alpha, const T* A, const T* B, const T
145143
Parallel_Common::recv_dev<T, Device>(Atmp_device, size, ip, 0, col_world, &status, A_tmp.data());
146144
MPI_Wait(&requests[ip], &status);
147145
ModuleBase::gemm_op<T, Device>()(ctx,
148-
transC,
149-
transN,
146+
'C',
147+
'N',
150148
m,
151149
ncolB,
152150
nrow,
@@ -195,8 +193,8 @@ void PGemmCN<T, Device>::multiply(const T alpha, const T* A, const T* B, const T
195193
{
196194
T real_beta = row_rank == 0 ? beta : 0;
197195
ModuleBase::gemm_op<T, Device>()(ctx,
198-
transC,
199-
transN,
196+
'C',
197+
'N',
200198
ncolA,
201199
ncolB,
202200
nrow,

source/module_hamilt_pw/hamilt_pwdft/fs_nonlocal_tools.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void FS_Nonlocal_tools<FPTYPE, Device>::reduce_pool_becp(const int& npm)
295295
#ifdef __MPI
296296
if (GlobalV::NPROC_IN_POOL > 1)
297297
{
298-
Parallel_Common::reduce_dev<FPTYPE,Device>(this->becp, size_becp_act, POOL_WORLD);
298+
Parallel_Common::reduce_dev<std::complex<FPTYPE>, Device>(this->becp, size_becp_act, POOL_WORLD);
299299
}
300300
#endif
301301
}

source/module_hsolver/diago_cg.cpp

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -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

259259
template <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

312312
template <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

Comments
 (0)