12 template<
typename AFIELD>
14 =
"ASolver_SAP_MINRES";
17 template<
typename AFIELD>
22 int nin = m_fopr->field_nin();
23 int nvol = m_fopr->field_nvol();
24 int nex = m_fopr->field_nex();
26 m_r.reset(nin, nvol, nex);
27 m_p.reset(nin, nvol, nex);
29 m_p2_block.resize(m_block_index->coarse_nvol());
30 m_alpha_block.resize(m_block_index->coarse_nvol());
33 m_r2_block.resize(m_block_index->coarse_nvol());
42 template<
typename AFIELD>
51 template<
typename AFIELD>
54 const string str_vlevel = params.
get_string(
"verbose_level");
63 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
64 err += params.
fetch_int(
"maximum_number_of_restart", Nrestart);
65 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
68 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
73 int Niter2 = Niter * Nrestart;
74 set_parameters(Niter2, Stop_cond);
79 template<
typename AFIELD>
86 m_Stop_cond = Stop_cond;
87 std::string prec =
"double";
88 if (
sizeof(
real_t) == 4) prec =
"float";
91 vout.
general(m_vl,
" Precision: %s\n", prec.c_str());
93 vout.
general(m_vl,
" Stop_cond = %16.8e\n", m_Stop_cond);
98 template<
typename AFIELD>
100 int& Nconv,
real_t& diff,
const int eo)
102 assert(m_block_index);
105 int ith, nth, is, ns;
106 set_threadtask(ith, nth, is, ns, m_block_index->coarse_nvol());
108 #pragma omp barrier // fine
114 #pragma omp barrier // coarse
116 for (
int i = is; i < ns; ++i) {
117 m_p2_block[i] =
real_t(1.0);
122 for (
int iter = 0; iter < m_Niter; ++iter) {
123 m_fopr->mult_sap(m_p, m_r, eo);
126 block_dotc_eo(&(m_alpha_block[0]), m_p, m_r, eo, *m_block_index);
128 for (
int i = is; i < ns; ++i) {
129 if (m_p2_block[i] > 0.0) {
130 m_alpha_block[i] /= m_p2_block[i];
153 for (
int i = 0; i < m_block_index->coarse_nvol(); ++i) {
156 if (m_block_index->block_eo(i) == eo) {
163 vout.
general(m_vl,
"iter=%d , sum(r2)=%e sum(p2)=%e\n", iter, r2, p2);
166 #endif // DEBUG_MINRES
174 template<
typename AFIELD>
177 return m_Niter * m_flop_each;
182 template<
typename AFIELD>
185 int Nin = m_fopr->field_nin();
186 int Nvol = m_fopr->field_nvol();
187 int Nex = m_fopr->field_nex();
193 size_t nvol2 = m_block_index->coarse_nvol() / 2;
194 size_t block_vol = m_block_index->block_nvol();
220 double flop_fopr = m_fopr->flop_count_sap();
221 double flop_norm2 = 8.0 * Nin * block_vol * nvol2 * NPE;
222 double flop_innerp = 8.0 * Nin * block_vol * nvol2 * NPE;
223 double flop_axpy = 8.0 * Nin * block_vol * nvol2 * NPE;
226 = (flop_fopr + flop_norm2 + flop_innerp + 2 * flop_axpy