ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
bpcg_kernel_op.h
Go to the documentation of this file.
1#ifndef MODULE_HSOLVER_BPCG_KERNEL_H
2#define MODULE_HSOLVER_BPCG_KERNEL_H
5namespace hsolver
6{
7
8template <typename T, typename Device>
10{
24 void operator()(T* grad_out,
25 T* hgrad_out,
26 T* psi_out,
27 T* hpsi_out,
28 const int& n_basis,
29 const int& n_basis_max,
30 const int& n_band);
31};
32
33template <typename T, typename Device>
35{
49 using Real = typename GetTypeReal<T>::type;
50 void operator()(const Real* prec_in,
51 Real* err_out,
52 Real* beta_out,
53 T* psi_out,
54 T* hpsi_out,
55 T* grad_out,
56 T* grad_old_out,
57 const int& n_basis,
58 const int& n_basis_max,
59 const int& n_band);
60};
61
62template <typename T, typename Device>
64{
65 using Real = typename GetTypeReal<T>::type;
66 void operator()(const int& nbase,
67 const int& nbase_x,
68 const int& notconv,
69 T* result,
70 const T* vectors,
71 const Real* eigenvalues);
72};
73
74template <typename T, typename Device>
76 using Real = typename GetTypeReal<T>::type;
77 void operator()(const int& dim,
78 T* psi_iter,
79 const int& nbase,
80 const int& notconv,
81 const Real* precondition,
82 const Real* eigenvalues);
83};
84
85template <typename T, typename Device>
87 using Real = typename GetTypeReal<T>::type;
88 void operator()(const int& dim,
89 T* psi_iter,
90 const int& nbase,
91 const int& notconv,
92 Real* psi_norm = nullptr);
93};
94
95#if __CUDA || __UT_USE_CUDA || __ROCM || __UT_USE_ROCM
96
97template <typename T>
98struct line_minimize_with_block_op<T, base_device::DEVICE_GPU> {
99 using Real = typename GetTypeReal<T>::type;
100 void operator()(T *grad_out, T *hgrad_out, T *psi_out, T *hpsi_out,
101 const int &n_basis, const int &n_basis_max,
102 const int &n_band);
103};
104
105template <typename T>
106struct calc_grad_with_block_op<T, base_device::DEVICE_GPU> {
107 using Real = typename GetTypeReal<T>::type;
108 void operator()(const Real *prec_in, Real *err_out, Real *beta_out,
109 T *psi_out, T *hpsi_out, T *grad_out, T *grad_old_out,
110 const int &n_basis, const int &n_basis_max,
111 const int &n_band);
112};
113
114template <typename T>
115struct apply_eigenvalues_op<T, base_device::DEVICE_GPU> {
116 using Real = typename GetTypeReal<T>::type;
117 void operator()(const int& nbase,
118 const int& nbase_x,
119 const int& notconv,
120 T* result,
121 const T* vectors,
122 const Real* eigenvalues);
123};
124
125template <typename T>
126struct precondition_op<T, base_device::DEVICE_GPU> {
127 using Real = typename GetTypeReal<T>::type;
128 void operator()(const int& dim,
129 T* psi_iter,
130 const int& nbase,
131 const int& notconv,
132 const Real* precondition,
133 const Real* eigenvalues);
134};
135
136template <typename T>
137struct normalize_op<T, base_device::DEVICE_GPU> {
138 using Real = typename GetTypeReal<T>::type;
139 void operator()(const int& dim,
140 T* psi_iter,
141 const int& nbase,
142 const int& notconv,
143 Real* psi_norm = nullptr);
144};
145
146#endif
147} // namespace hsolver
148
149#endif
#define T
Definition exp.cpp:237
Definition device.cpp:21
Definition diag_comm_info.h:9
T type
Definition macros.h:8
Definition bpcg_kernel_op.h:64
typename GetTypeReal< T >::type Real
Definition bpcg_kernel_op.h:65
void operator()(const int &nbase, const int &nbase_x, const int &notconv, T *result, const T *vectors, const Real *eigenvalues)
Definition bpcg_kernel_op.h:35
void operator()(const Real *prec_in, Real *err_out, Real *beta_out, T *psi_out, T *hpsi_out, T *grad_out, T *grad_old_out, const int &n_basis, const int &n_basis_max, const int &n_band)
typename GetTypeReal< T >::type Real
dot_real_op computes the dot product of the given complex arrays(treated as float arrays)....
Definition bpcg_kernel_op.h:49
Definition bpcg_kernel_op.h:10
void operator()(T *grad_out, T *hgrad_out, T *psi_out, T *hpsi_out, const int &n_basis, const int &n_basis_max, const int &n_band)
dot_real_op computes the dot product of the given complex arrays(treated as float arrays)....
Definition bpcg_kernel_op.h:86
typename GetTypeReal< T >::type Real
Definition bpcg_kernel_op.h:87
void operator()(const int &dim, T *psi_iter, const int &nbase, const int &notconv, Real *psi_norm=nullptr)
Definition bpcg_kernel_op.h:75
void operator()(const int &dim, T *psi_iter, const int &nbase, const int &notconv, const Real *precondition, const Real *eigenvalues)
typename GetTypeReal< T >::type Real
Definition bpcg_kernel_op.h:76