Skip to content

Commit 8f73fc1

Browse files
authored
fix ifpsolver output (#1730)
- fix IFPSolver output and timer
1 parent 8f18158 commit 8f73fc1

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

alien/ArcaneInterface/modules/ifpen_solvers/src/alien/kernels/ifp/linear_solver/IFPInternalLinearSolver.cc

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,18 @@ IFPInternalLinearSolver::getStatus() const
182182
bool
183183
IFPInternalLinearSolver::solve(const MatrixType& A, const VectorType& b, VectorSolType& x)
184184
{
185+
alien_info(m_print_info, [&] {
186+
cout() << "|--------------------------------------------------------|";
187+
cout() << "| Start Linear Solver #" << m_stat.solveCount();
188+
});
189+
185190
if (m_parallel_mng == nullptr)
186191
return true;
187192

188193
bool isSolverOk = false;
189194

190195
SolverStatSentry<IFPInternalLinearSolver> sentry(m_stater, BaseSolverStater::ePrepare);
191196

192-
// m_stater.startPrepareMeasure();
193-
194197
using namespace Alien;
195198
// C'est a ce moment la, que la IFP matrice est construite.
196199
// Avant d'arriver la, la matrice est stockee dans la SimpleCSRMatrix
@@ -219,9 +222,12 @@ IFPInternalLinearSolver::solve(const MatrixType& A, const VectorType& b, VectorS
219222
if (!matrix.getSymmetricProfile()
220223
&& m_options->ilu0Algo() == IFPSolverProperty::Optimized)
221224
m_ilu0_algo = 4;
225+
222226
sentry.release();
223227

228+
224229
SolverStatSentry<IFPInternalLinearSolver> sentry2(m_stater, BaseSolverStater::eSolve);
230+
225231
if (matrix.internal()->m_system_is_resizeable == true)
226232
isSolverOk = _solveRs(matrix.internal()->m_system_is_resizeable);
227233
else
@@ -237,6 +243,16 @@ IFPInternalLinearSolver::solve(const MatrixType& A, const VectorType& b, VectorS
237243
// La valeur de b en cas d'échec n'est actuellement pas bien définie : à tester.
238244
}
239245

246+
sentry2.release();
247+
248+
if(m_print_info)
249+
internalPrintInfo();
250+
251+
alien_info(m_print_info, [&] {
252+
cout() << "| End Linear Solver";
253+
cout() << "|--------------------------------------------------------|";
254+
});
255+
240256
return isSolverOk;
241257
}
242258

@@ -247,54 +263,27 @@ IFPInternalLinearSolver::_solve()
247263
{
248264
bool m_resizeable = false;
249265

250-
alien_info(m_print_info, [&] {
251-
cout() << "|--------------------------------------------------------|";
252-
cout() << "| Start Linear Solver #" << m_stat.solveCount();
253-
});
254-
255266
F2C(ifpsolversolve)
256267
(&m_max_iteration, &m_stop_criteria_value, &m_precond_option, &m_precond_pressure,
257268
&m_normalisation_pivot, &m_ilu0_algo, &m_resizeable);
258269
F2C(ifpsolvergetsolverstatus)
259270
(&m_status.error, &m_status.iteration_count, &m_status.residual);
260271
m_status.succeeded = (m_status.error == 0);
261272

262-
// m_stater.stopSolveMeasure(m_status);
263-
264-
alien_info(m_print_info, [&] {
265-
cout() << "| End Linear Solver";
266-
cout() << "|--------------------------------------------------------|";
267-
});
268-
269273
return m_status.succeeded;
270274
}
271275

272276
// A. Anciaux
273277
bool
274278
IFPInternalLinearSolver::_solveRs(bool m_resizeable)
275279
{
276-
alien_info(m_print_info, [&] {
277-
cout() << "|--------------------------------------------------------|";
278-
cout() << "| Start Linear Solver #" << m_stat.solveCount();
279-
});
280-
281-
// m_stater.startSolveMeasure();
282-
283280
F2C(ifpsolversolve)
284281
(&m_max_iteration, &m_stop_criteria_value, &m_precond_option, &m_precond_pressure,
285282
&m_normalisation_pivot, &m_ilu0_algo, &m_resizeable);
286283
F2C(ifpsolvergetsolverstatus)
287284
(&m_status.error, &m_status.iteration_count, &m_status.residual);
288285
m_status.succeeded = (m_status.error == 0);
289286

290-
// m_stater.stopSolveMeasure(m_status);
291-
292-
alien_info(m_print_info, [&] {
293-
cout() << "| End Linear Solver";
294-
cout() << "|--------------------------------------------------------|";
295-
internalPrintInfo();
296-
});
297-
298287
return m_status.succeeded;
299288
}
300289

@@ -307,19 +296,21 @@ IFPInternalLinearSolver::internalPrintInfo() const
307296
Universe().traceMng(), m_status, String("Linear Solver : IFPLinearSolver"));
308297
Real init_solver_count = 0;
309298
Real init_precond_count = 0;
310-
Real normalyze_count = 0;
299+
Real normalize_count = 0;
311300
Real loop_solver_count = 0;
312301
F2C(ifpsolvergetperfcount)
313-
(&init_solver_count, &init_precond_count, &normalyze_count, &loop_solver_count);
314-
alien_info([&] {
315-
cout() << "|--------------------------------------------------------|";
316-
cout() << "| IFPSolver : |";
317-
cout() << "|--------------------------------------------------------|";
318-
cout() << "| init solver time : " << init_solver_count;
319-
cout() << "| init precond time : " << init_precond_count;
320-
cout() << "| normalisation time : " << normalyze_count;
321-
cout() << "| loop solver time : " << loop_solver_count;
322-
cout() << "|--------------------------------------------------------|";
302+
(&init_solver_count, &init_precond_count, &normalize_count, &loop_solver_count);
303+
304+
// TODO: find a way to automatically set spaces
305+
alien_info([&]{
306+
cout() << "|--------------------------------------------------------|\n"
307+
" | IFPSolver : |\n"
308+
" |--------------------------------------------------------|\n"
309+
" | init solver time : " << Arccore::Trace::Precision(4,init_solver_count,true) << "\n"
310+
" | init precond time : " << Arccore::Trace::Precision(4,init_precond_count,true) << "\n"
311+
" | normalisation time : " << Arccore::Trace::Precision(4, normalize_count,true) << "\n"
312+
" | loop solver time : " << Arccore::Trace::Precision(4,loop_solver_count,true) << "\n"
313+
" |--------------------------------------------------------|";
323314
});
324315
}
325316

@@ -339,7 +330,6 @@ IFPInternalLinearSolverFactory(
339330
#include <ALIEN/axl/IFPLinearSolver_IOptions.h>
340331
#include <ALIEN/axl/IFPLinearSolver_StrongOptions.h>
341332

342-
343333
namespace Alien {
344334

345335
template<>

0 commit comments

Comments
 (0)