PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
pastix_task_sopalin.c
Go to the documentation of this file.
1/**
2 *
3 * @file pastix_task_sopalin.c
4 *
5 * PaStiX factorization routines
6 *
7 * @copyright 2004-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 6.4.0
11 * @author Pascal Henon
12 * @author Xavier Lacoste
13 * @author Pierre Ramet
14 * @author Mathieu Faverge
15 * @author Esragul Korkmaz
16 * @author Gregoire Pichon
17 * @author Theophile Terraz
18 * @author Alycia Lisito
19 * @author Brieuc Nicolas
20 * @author nbredel
21 * @author Nolan Bredel
22 * @author Tony Delarue
23 * @date 2024-07-05
24 *
25 **/
26#include "common.h"
27#include <lapacke.h>
28#include "isched.h"
29#include <spm.h>
30#include "bcsc/bcsc.h"
31#include "blend/solver.h"
32#include "coeftab.h"
33#include "sopalin/sopalin_data.h"
40#include "pastix_papi.h"
41
42#if defined(PASTIX_WITH_PARSEC)
44#endif
45
46#if defined(PASTIX_WITH_STARPU)
48#endif
49
50#ifndef DOXYGEN_SHOULD_SKIP_THIS
51static void (*sopalinFacto[5][4])(pastix_data_t *, sopalin_data_t*) =
52{
58};
59#endif /* DOXYGEN_SHOULD_SKIP_THIS */
60
61/**
62 *******************************************************************************
63 *
64 * @ingroup pastix_numfact
65 *
66 * @brief Fill the internal block CSC structure.
67 *
68 * This internal block CSC can be used by the refinement step with or without
69 * the preconditioner obtained by the numerical factorization.
70 *
71 * This routine is affected by the following parameters:
72 * IPARM_VERBOSE.
73 *
74 *******************************************************************************
75 *
76 * @param[inout] pastix_data
77 * The pastix_data structure that describes the solver instance.
78 * On exit, the internal block CSC is filled with entries from
79 * the spm matrix.
80 *
81 * @param[inout] spm
82 * The sparse matrix descriptor that describes problem instance.
83 * On exit, if IPARM_FREE_CSCUSER is set, the spm is freed.
84 *
85 *******************************************************************************
86 *
87 * @retval PASTIX_SUCCESS on successful exit,
88 * @retval PASTIX_ERR_BADPARAMETER if one parameter is incorrect,
89 * @retval PASTIX_ERR_OUTOFMEMORY if one allocation failed.
90 *
91 *******************************************************************************/
92int
94 spmatrix_t *spm )
95{
96 double time;
97
98 /*
99 * Check parameters
100 */
101 if (pastix_data == NULL) {
102 pastix_print_error( "pastix_subtask_spm2bcsc: wrong pastix_data parameter" );
104 }
105 if (spm == NULL) {
106 pastix_print_error( "pastix_subtask_spm2bcsc: wrong spm parameter" );
108 }
109 if ( !(pastix_data->steps & STEP_ANALYSE) ) {
110 pastix_print_error( "pastix_subtask_spm2bcsc: All steps from pastix_task_init() to pastix_task_blend() have to be called before calling this function" );
112 }
113
114 /*
115 * Compute the norm of A, to scale the epsilon parameter for pivoting
116 */
117 {
118 pastix_data->dparm[ DPARM_A_NORM ] = spmNorm( SpmFrobeniusNorm, spm );
119 if ( pastix_data->iparm[IPARM_VERBOSE] > PastixVerboseNo ) {
120 pastix_print( pastix_data->inter_node_procnum, 0,
121 " ||A||_2 = %e\n",
122 pastix_data->dparm[ DPARM_A_NORM ] );
123 }
124 }
125
126 /*
127 * Switch the SolverMatrix pointer according to the runtime.
128 */
129 {
130 pastix_int_t isched = pastix_data->iparm[IPARM_SCHEDULER];
131
132 /*
133 * Temporary disable LDL[th] factorization with runtime
134 */
135 if ( ( isched == PastixSchedParsec ) &&
136 ( ( pastix_data->iparm[IPARM_FACTORIZATION] == PastixFactLDLH ) ||
137 ( pastix_data->iparm[IPARM_FACTORIZATION] == PastixFactLDLT ) ) ) {
138 isched = PastixSchedDynamic;
139 }
140
141 if ( isSchedRuntime( isched ) ) {
142 pastix_data->solvmatr = pastix_data->solvglob;
143 }
144 else {
145 assert( isSchedPthread( isched ) );
146 pastix_data->solvmatr = pastix_data->solvloc;
147 }
148 pastix_data->sched = isched;
149 }
150
151 /*
152 * Fill in the internal blocked CSC. We consider that if this step is called
153 * the spm values have changed so we need to update the blocked csc.
154 */
155 if ( pastix_data->bcsc != NULL )
156 {
157 bcscExit( pastix_data->bcsc );
158 memFree_null( pastix_data->bcsc );
159 }
160 MALLOC_INTERN( pastix_data->bcsc, 1, pastix_bcsc_t );
161
162 time = bcscInit( spm,
163 pastix_data->ordemesh,
164 pastix_data->solvmatr,
165 (pastix_data->iparm[IPARM_FACTORIZATION] == PastixFactLU), /*&& (! pastix_data->iparm[IPARM_ONLY_REFINE]) )*/
166 pastix_data->bcsc );
167
168 if ( pastix_data->iparm[IPARM_VERBOSE] > PastixVerboseNot ) {
169 pastix_print( pastix_data->inter_node_procnum, 0, OUT_BCSC_TIME, time );
170 }
171
172 if ( pastix_data->iparm[IPARM_FREE_CSCUSER] ) {
173 spmExit( spm );
174 }
175
176 /*
177 * Invalidate following step, and add current step to the ones performed
178 */
179 pastix_data->steps &= ~STEP_BCSC2CTAB;
180 pastix_data->steps |= STEP_CSC2BCSC;
181
182 return PASTIX_SUCCESS;
183}
184
185/**
186 *******************************************************************************
187 *
188 * @ingroup pastix_numfact
189 *
190 * @brief Fill the internal solver matrix structure.
191 *
192 * This step is linked with the pastix_subtask_sopalin() since this structure is
193 * only used during the numerical factorization.
194 *
195 * This routine is affected by the following parameters:
196 * IPARM_VERBOSE, [IPARM_FACTORIZATION.
197 *
198 *******************************************************************************
199 *
200 * @param[inout] pastix_data
201 * The pastix_data structure that describes the solver instance.
202 * On exit, the internal solver structure is filled with entries from
203 * the internal block CSC matrix.
204 *
205 *******************************************************************************
206 *
207 * @retval PASTIX_SUCCESS on successful exit,
208 * @retval PASTIX_ERR_BADPARAMETER if one parameter is incorrect,
209 * @retval PASTIX_ERR_OUTOFMEMORY if one allocation failed.
210 *
211 *******************************************************************************/
212int
214{
215 pastix_bcsc_t *bcsc;
216 pastix_lr_t *lr;
217 Clock timer;
218 pastix_mtxtype_t mtxtype;
219
220 /*
221 * Check parameters
222 */
223 if (pastix_data == NULL) {
224 pastix_print_error( "pastix_subtask_bcsc2ctab: wrong pastix_data parameter" );
226 }
227 if ( !(pastix_data->steps & STEP_CSC2BCSC) ) {
228 pastix_print_error( "pastix_subtask_bcsc2ctab: All steps from pastix_task_init() to pastix_stask_blend() have to be called before calling this function" );
230 }
231 if (pastix_data->bcsc == NULL) {
232 pastix_print_error( "pastix_subtask_bcsc2ctab: wrong pastix_data->bcsc parameter" );
234 }
235
236 /* Ensure that the scheduler is correct */
237 pastix_check_and_correct_scheduler( pastix_data );
238
239 clockSyncStart( timer, pastix_data->inter_node_comm );
240
241 /* Initialize low-rank parameters */
242 lr = &(pastix_data->solvmatr->lowrank);
243 lr->compress_when = pastix_data->iparm[IPARM_COMPRESS_WHEN];
244 lr->compress_method = pastix_data->iparm[IPARM_COMPRESS_METHOD];
248 lr->use_reltol = pastix_data->iparm[IPARM_COMPRESS_RELTOL];
249 lr->tolerance = pastix_data->dparm[DPARM_COMPRESS_TOLERANCE];
250 lr->ilu_lvl = pastix_data->iparm[IPARM_COMPRESS_ILUK];
251
254
255 bcsc = pastix_data->bcsc;
256
257 /* Make sure that mixed-precision isn't called in single precision */
258 {
259 int isDouble = (bcsc->flttype == PastixComplex64) || (bcsc->flttype == PastixDouble);
260 if ( pastix_data->iparm[IPARM_MIXED] && !isDouble )
261 {
262 pastix_print_warning( "pastix_subtask_bcsc2ctab: Mixed precision solve is not possible with single precision matrix\n"
263 " Mixed precision is disabled\n" );
264 pastix_data->iparm[IPARM_MIXED] = 0;
265 }
266 }
267
268 /* Make sure IPARM_MIXED is 0 or 1 */
269 pastix_data->iparm[IPARM_MIXED] = pastix_data->iparm[IPARM_MIXED] ? 1 : 0;
270
271 /* Initialize the float type of the solver matrix */
272 pastix_data->solvmatr->flttype = bcsc->flttype - pastix_data->iparm[IPARM_MIXED];
273
274 /* Associate the compression methods corresponding to the precision of the solver matrix */
275 lr->core_ge2lr = ge2lrMethods[ pastix_data->iparm[IPARM_COMPRESS_METHOD] ][ (pastix_data->solvmatr->flttype-2) ];
276 lr->core_rradd = rraddMethods[ pastix_data->iparm[IPARM_COMPRESS_METHOD] ][ (pastix_data->solvmatr->flttype-2) ];
277
278 /*
279 * Update the ilu level based on when
280 */
281 if ( lr->ilu_lvl == -2 ) {
282 if ( pastix_data->iparm[IPARM_COMPRESS_WHEN] == PastixCompressWhenBegin ) {
283 lr->ilu_lvl = -1;
284 }
285 else if ( pastix_data->iparm[IPARM_COMPRESS_WHEN] == PastixCompressWhenEnd ) {
286 lr->ilu_lvl = INT_MAX;
287 }
288 else if ( pastix_data->iparm[IPARM_COMPRESS_WHEN] == PastixCompressWhenDuring ) {
289 lr->ilu_lvl = 0;
290 }
291 }
292
293 /*
294 * Set the maximum rank function
295 */
296 if ( pastix_data->iparm[IPARM_COMPRESS_WHEN] == PastixCompressWhenBegin ) {
298 }
299 else {
301 }
302
303 pastix_data->solvmatr->factotype = pastix_data->iparm[IPARM_FACTORIZATION];
304
305#if defined(PASTIX_WITH_MPI)
306 if ( ( pastix_data->iparm[IPARM_COMPRESS_WHEN] != PastixCompressNever ) &&
307 ( pastix_data->iparm[IPARM_SCHEDULER] == PastixSchedParsec ) &&
308 ( pastix_data->procnbr > 1 ) )
309 {
310 pastix_print_error( "pastix_task_sopalin: Low-Rank with MPI communication is not available yet with PaRSEC\n" );
312 }
313#endif
314 /*
315 * Fill in the internal coeftab structure. We consider that if this step is
316 * called the bcsc values have changed, or a factorization have already been
317 * performed, so we need to update the coeftab arrays.
318 */
319 if (pastix_data->bcsc != NULL)
320 {
321 coeftabExit( pastix_data->solvmatr );
322 }
323
324 coeftabInit( pastix_data,
326
327 switch( pastix_data->iparm[IPARM_FACTORIZATION] ) {
328 case PastixFactLLH:
329 case PastixFactLDLH:
330 mtxtype = PastixHermitian;
331 break;
332
333 case PastixFactLLT:
334 case PastixFactLDLT:
335 mtxtype = PastixSymmetric;
336 break;
337
338 case PastixFactLU:
339 default:
340 mtxtype = PastixGeneral;
341 }
342
343#if defined(PASTIX_WITH_PARSEC)
344 if ( pastix_data->iparm[IPARM_SCHEDULER] == PastixSchedParsec )
345 {
346 /* Start PaRSEC if not already started */
347 if (pastix_data->parsec == NULL) {
348 int argc = 0;
349 pastix_parsec_init( pastix_data, &argc, NULL, NULL );
350 }
351 /* Create the matrix descriptor */
353 pastix_size_of( bcsc->flttype ), mtxtype,
354 pastix_data->inter_node_procnbr,
355 pastix_data->inter_node_procnum );
356 }
357#endif
358
359#if defined(PASTIX_WITH_STARPU)
360 if ( pastix_data->iparm[IPARM_SCHEDULER] == PastixSchedStarPU )
361 {
362 /* Create the matrix descriptor */
364 mtxtype,
365 pastix_data->inter_node_procnbr,
366 pastix_data->inter_node_procnum,
367 pastix_data->bcsc->flttype );
368 }
369#endif
370
371 clockSyncStop( timer, pastix_data->inter_node_comm );
372 if ( pastix_data->iparm[IPARM_VERBOSE] > PastixVerboseNot ) {
373 pastix_print( pastix_data->inter_node_procnum, 0, OUT_COEFTAB_TIME,
374 clockVal(timer) );
375 }
376
377 /* Invalidate following step, and add current step to the ones performed */
378 pastix_data->steps &= ~STEP_NUMFACT;
379 pastix_data->steps |= STEP_BCSC2CTAB;
380
381 (void)mtxtype;
382 return PASTIX_SUCCESS;
383}
384
385/**
386 *******************************************************************************
387 *
388 * @ingroup pastix_numfact
389 *
390 * @brief Factorize the given problem using Cholesky or LU decomposition.
391 *
392 * The user can call the pastix_task_solve() to obtain the solution.
393 *
394 * This routine is affected by the following parameters:
395 * IPARM_VERBOSE, IPARM_FACTORIZATION, IPARM_COMPRESS_WHEN.
396 *
397 *******************************************************************************
398 *
399 * @param[inout] pastix_data
400 * The pastix_data structure that describes the solver instance.
401 * On exit, the solver matrix structure stores the factorization of the
402 * given problem.
403 *
404 *******************************************************************************
405 *
406 * @retval PASTIX_SUCCESS on successful exit,
407 * @retval PASTIX_ERR_BADPARAMETER if one parameter is incorrect,
408 * @retval PASTIX_ERR_OUTOFMEMORY if one allocation failed.
409 *
410 *******************************************************************************/
411int
413{
414 sopalin_data_t sopalin_data;
415 SolverBackup_t *sbackup;
416 pastix_bcsc_t *bcsc;
417 PASTIX_Comm pastix_comm;
418 pastix_int_t *iparm;
419 double *dparm;
420 int prevnt;
421
422 /*
423 * Check parameters
424 */
425 if (pastix_data == NULL) {
426 pastix_print_error( "pastix_subtask_sopalin: wrong pastix_data parameter" );
428 }
429 if ( !(pastix_data->steps & STEP_ANALYSE) ) {
430 pastix_print_error( "pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
432 }
433 if ( !(pastix_data->steps & STEP_CSC2BCSC) ) {
434 pastix_print_error( "pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
436 }
437 if ( !(pastix_data->steps & STEP_BCSC2CTAB) ) {
438 pastix_print_error( "pastix_subtask_sopalin: All steps from pastix_task_init() to pastix_task_analyze() have to be called before calling this function" );
440 }
441
442 bcsc = pastix_data->bcsc;
443 if (bcsc == NULL) {
444 pastix_print_error( "pastix_subtask_sopalin: wrong pastix_data_bcsc parameter" );
446 }
447
448 /* Ensure that the scheduler is correct */
449 pastix_check_and_correct_scheduler( pastix_data );
450
451 pastix_comm = pastix_data->inter_node_comm;
452 iparm = pastix_data->iparm;
453 dparm = pastix_data->dparm;
454
455 /*
456 * If linked to a multithreaded blas we will set number of blas threads to
457 * 1 during numerical steps. We need to save the original value to restore
458 * it because external libraries may be used in between of just after
459 * pastix calls.
460 */
462
463 /* Prepare the sopalin_data structure */
464 {
465 double threshold;
466
467 sopalin_data.solvmtx = pastix_data->solvmatr;
468
469 /* TODO: might change the behavior: if the user wants a ratio of the norm, it could compute it himself */
470 if ( dparm[ DPARM_EPSILON_MAGN_CTRL ] < 0. ) {
471 threshold = - dparm[ DPARM_EPSILON_MAGN_CTRL ];
472 }
473 else if ( dparm[ DPARM_EPSILON_MAGN_CTRL ] == 0. ) {
474 /*
475 * Use the rule presented in "Making Sparse Gaussian Elimination
476 * Scalable by Static Pivoting", S. X. Li, J. Demmel
477 *
478 * sqrt(eps) * ||A||_1 is a small half precision perturbation
479 * introduced in the pb when the pivot is too small
480 */
481 double eps;
482 if ( (bcsc->flttype == PastixFloat) || (bcsc->flttype == PastixComplex32) ) {
483 eps = LAPACKE_slamch_work( 'e' );
484 }
485 else {
486 eps = LAPACKE_dlamch_work( 'e' );
487 }
488 threshold = eps * dparm[DPARM_A_NORM];
489 }
490 else {
491 threshold = dparm[ DPARM_EPSILON_MAGN_CTRL ] * dparm[DPARM_A_NORM];
492 }
493
494 sopalin_data.solvmtx->diagthreshold = threshold;
495 sopalin_data.solvmtx->nbpivots = 0;
496
497 sopalin_data.cpu_coefs = &(pastix_data->cpu_models->coefficients[bcsc->flttype-2]);
498 sopalin_data.gpu_coefs = &(pastix_data->gpu_models->coefficients[bcsc->flttype-2]);
499 sopalin_data.cpu_models = pastix_data->cpu_models;
500 sopalin_data.gpu_models = pastix_data->gpu_models;
501 }
502
503 sbackup = solverBackupInit( pastix_data->solvmatr );
504 pastix_data->solvmatr->restore = 2;
505 {
506 void (*factofct)( pastix_data_t *, sopalin_data_t *);
507 double timer, timer_local, flops, flops_g, energy = 0.;
508
509 factofct = sopalinFacto[ pastix_data->iparm[IPARM_FACTORIZATION] ][pastix_data->solvmatr->flttype-2];
510 assert(factofct);
511
512 papiEnergyStart();
513 if ( pastix_data->iparm[IPARM_TRACE] & PastixTraceNumfact ) {
515 }
516 clockSyncStart( timer, pastix_comm );
517 clockStart(timer_local);
518
519 factofct( pastix_data, &sopalin_data );
520
521 clockStop(timer_local);
522 clockSyncStop( timer, pastix_comm );
523 if ( pastix_data->iparm[IPARM_TRACE] & PastixTraceNumfact ) {
525 }
526 energy = papiEnergyStop();
527
528 /* Output time, flops, energy and power */
529 pastix_data->dparm[DPARM_FACT_TIME] = clockVal(timer);
530 flops = pastix_data->dparm[DPARM_FACT_THFLOPS] / pastix_data->dparm[DPARM_FACT_TIME];
531 pastix_data->dparm[DPARM_FACT_FLOPS] = ((flops / 1024.) / 1024.) / 1024.;
532 pastix_data->dparm[DPARM_FACT_ENERGY] = energy;
533
534 /* Compute the number of flops performed (may be different from THFLOPS for low-rank) */
535 {
536 double flops_l = pastix_data->dparm[DPARM_FACT_RLFLOPS];
537 MPI_Allreduce( &flops_l, &flops_g, 1, MPI_DOUBLE, MPI_SUM, pastix_data->inter_node_comm );
538 }
539
540 /* Reduce the number of pivots */
541 {
542 int nbpivot_l = sopalin_data.solvmtx->nbpivots;
543 int nbpivot_g;
544 MPI_Allreduce( &nbpivot_l, &nbpivot_g, 1, MPI_INT, MPI_SUM, pastix_data->inter_node_comm );
545 pastix_data->iparm[IPARM_STATIC_PIVOTING] = nbpivot_g;
546 }
547
548 if ( iparm[IPARM_VERBOSE] > PastixVerboseNot ) {
549 pastix_print( pastix_data->inter_node_procnum, 0, OUT_SOPALIN_TIME,
550 clockVal(timer),
551 pastix_print_value( flops ),
552 pastix_print_unit( flops ),
553 pastix_print_value( flops_g ),
554 pastix_print_unit( flops_g ),
555 (long)pastix_data->iparm[IPARM_STATIC_PIVOTING] );
556#if defined(PASTIX_WITH_PAPI)
557 {
558 double power = energy / pastix_data->dparm[DPARM_FACT_TIME];
559 pastix_print( pastix_data->inter_node_procnum, 0, OUT_SOPALIN_ENERGY,
560 pastix_print_value_deci( energy ),
561 pastix_print_unit_deci( energy ),
562 pastix_print_value_deci( power ),
563 pastix_print_unit_deci( power ) );
564 }
565#endif
566 }
567
568#if defined(PASTIX_WITH_PARSEC) && defined(PASTIX_DEBUG_PARSEC)
569 {
570 int i;
571 fprintf(stderr, "-- Check status of PaRSEC nbtasks counters\n" );
572 for (i=0; i<32; i++) {
573 if ( parsec_nbtasks_on_gpu[i] != 0 ) {
574 fprintf(stderr, "Device %d => %d\n",
575 i, parsec_nbtasks_on_gpu[i] );
576 }
577 parsec_nbtasks_on_gpu[i] = 0;
578 }
579 }
580#endif /* defined(PASTIX_WITH_PARSEC) && defined(PASTIX_DEBUG_PARSEC) */
581 }
582 pastixBlasSetNumThreads( prevnt );
583 solverBackupRestore( pastix_data->solvmatr, sbackup );
584 solverBackupExit( sbackup );
585
586#if defined(PASTIX_NUMFACT_DUMP_SOLVER)
587 {
588 FILE *stream = NULL;
589
590 pastix_gendirectories( pastix_data );
591 stream = pastix_fopenw( pastix_data->dir_local, "solver.eps", "w" );
592 if ( stream ) {
593 solverDraw( pastix_data->solvmatr,
594 stream, iparm[IPARM_VERBOSE],
595 pastix_data->dir_local );
596 fclose(stream);
597 }
598 }
599#endif
600
601 /* Compute the memory usage */
602 {
603 coeftabMemory[pastix_data->solvmatr->flttype-2]( pastix_data->solvmatr, pastix_data->iparm, pastix_data->dparm );
604#if defined(PASTIX_WITH_MPI)
605 MPI_Allreduce( MPI_IN_PLACE, pastix_data->dparm + DPARM_MEM_FR, 1, MPI_DOUBLE, MPI_SUM, pastix_data->inter_node_comm );
606 MPI_Allreduce( MPI_IN_PLACE, pastix_data->dparm + DPARM_MEM_LR, 1, MPI_DOUBLE, MPI_SUM, pastix_data->inter_node_comm );
607#endif
608 }
609
610 /* Invalidate following steps, and add factorization step to the ones performed */
611 pastix_data->steps &= ~( STEP_BCSC2CTAB |
612 STEP_SOLVE |
613 STEP_REFINE );
614 pastix_data->steps |= STEP_NUMFACT;
615
616 (void)pastix_comm;
617 return EXIT_SUCCESS;
618}
619
620/**
621 *******************************************************************************
622 *
623 * @ingroup pastix_users
624 *
625 * @brief Perform all the numerical factorization steps:
626 * fill the internal block CSC and the solver matrix structures,
627 * then apply the factorization step.
628 *
629 * The user can call the pastix_task_solve() to obtain the solution.
630 *
631 * This routine is affected by the following parameters:
632 * IPARM_VERBOSE.
633 *
634 *******************************************************************************
635 *
636 * @param[inout] pastix_data
637 * The pastix_data structure that describes the solver instance.
638 * On exit, the internal block CSC is filled with entries from the
639 * spm matrix and the solver matrix structure stores the factorization
640 * of the given problem.
641 *
642 * @param[inout] spm
643 * The sparse matrix descriptor that describes problem instance.
644 * On exit, the spm structure is freed if IPARM_FREE_CSCUSER is true.
645 *
646 *******************************************************************************
647 *
648 * @retval PASTIX_SUCCESS on successful exit,
649 * @retval PASTIX_ERR_BADPARAMETER if one parameter is incorrect,
650 * @retval PASTIX_ERR_OUTOFMEMORY if one allocation failed.
651 *
652 *******************************************************************************/
653int
655 spmatrix_t *spm )
656{
657 pastix_int_t *iparm;
658 pastix_int_t procnum;
659 pastix_int_t steps;
660 int rc;
661
662 /*
663 * Check parameters
664 */
665 if (pastix_data == NULL) {
666 pastix_print_error( "pastix_task_sopalin: wrong pastix_data parameter" );
668 }
669 if (spm == NULL) {
670 pastix_print_error( "pastix_task_sopalin: wrong spm parameter" );
672 }
673 if ( !(pastix_data->steps & STEP_ANALYSE) ) {
674 pastix_print_error( "pastix_task_sopalin: All steps from pastix_task_init() to pastix_task_blend() have to be called before calling this function" );
676 }
677
678 iparm = pastix_data->iparm;
679 procnum = pastix_data->inter_node_procnum;
680
681 if (iparm[IPARM_VERBOSE] > PastixVerboseNot) {
682 pastix_print( procnum, 0, OUT_STEP_SOPALIN,
683 pastixFactotypeStr( iparm[IPARM_FACTORIZATION] ) );
684 }
685
686 /* Invalidate upcoming steps */
687 steps = ~(STEP_CSC2BCSC |
688 STEP_BCSC2CTAB |
689 STEP_NUMFACT |
690 STEP_SOLVE |
691 STEP_REFINE );
692 pastix_data->steps &= steps;
693
694 rc = pastix_subtask_spm2bcsc( pastix_data, spm );
695 if (rc != PASTIX_SUCCESS) {
696 return rc;
697 }
698
699 rc = pastix_subtask_bcsc2ctab( pastix_data );
700 if (rc != PASTIX_SUCCESS) {
701 return rc;
702 }
703
704 rc = pastix_subtask_sopalin( pastix_data );
705 if (rc != PASTIX_SUCCESS) {
706 return rc;
707 }
708
709 return EXIT_SUCCESS;
710}
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
double bcscInit(const spmatrix_t *spm, const pastix_order_t *ord, const SolverMatrix *solvmtx, pastix_int_t initAt, pastix_bcsc_t *bcsc)
Initializes the block csc matrix.
Definition bcsc.c:1899
void bcscExit(pastix_bcsc_t *bcsc)
Frees the block csc structure but do not free the bcsc pointer.
Definition bcsc.c:1929
int solverBackupRestore(SolverMatrix *solvmtx, const SolverBackup_t *b)
Restore initial values.
void solverBackupExit(SolverBackup_t *b)
Free the solver backup data structure.
int solverDraw(const SolverMatrix *solvptr, FILE *stream, int verbose, const char *directory)
Writes a PostScript picture of the low-rank solver matrix.
Definition solver_draw.c:56
SolverBackup_t * solverBackupInit(const SolverMatrix *solvmtx)
Initialize the backup structure.
void coeftabInit(pastix_data_t *pastix_data, pastix_coefside_t side)
Initialize the solver matrix structure.
Definition coeftab.c:205
void coeftabExit(SolverMatrix *solvmtx)
Free the solver matrix structure.
Definition coeftab.c:268
coeftab_fct_memory_t coeftabMemory[4]
List of functions to compute the memory gain in low-rank per precision.
Definition coeftab.c:45
void kernelsTraceStart(void)
Resumes the trace module.
void kernelsTraceStop(void)
Pauses the trace module.
pastix_compress_method_t compress_method
pastix_int_t compress_min_width
fct_rradd_t core_rradd
fct_ge2lr_t core_ge2lr
pastix_int_t compress_min_height
pastix_compress_when_t compress_when
static pastix_int_t core_get_rklimit_end(pastix_int_t M, pastix_int_t N)
Compute the maximal rank accepted for a given matrix size for Just-In-Time strategy.
const fct_rradd_t rraddMethods[PastixCompressMethodNbr][4]
Array of pointers to the multiple arithmetic and algorithmic variants of rradd.
Definition lowrank.c:52
const fct_ge2lr_t ge2lrMethods[PastixCompressMethodNbr][4]
Array of pointers to the multiple arithmetic and algorithmic variants of ge2lr.
Definition lowrank.c:43
double pastix_lr_minratio
Define the minimal ratio for which we accept to compress a matrix into a low-rank form or not.
Definition lowrank.c:24
pastix_int_t pastix_lr_ortho
Define the orthogonalization method.
Definition lowrank.c:25
pastix_int_t(* core_get_rklimit)(pastix_int_t, pastix_int_t)
Compute the maximal rank accepted for a given matrix size. The pointer is set according to the low-ra...
static pastix_int_t core_get_rklimit_begin(pastix_int_t M, pastix_int_t N)
Compute the maximal rank accepted for a given matrix size for Minimal-Memory strategy.
Structure to define the type of function to use for the low-rank kernels and their parameters.
#define PastixSymmetric
Definition api.h:459
int pastixBlasSetNumThreadsOne(void)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) to 1 and return the previous number of...
Definition api.c:1179
#define PastixGeneral
Definition api.h:458
spm_mtxtype_t pastix_mtxtype_t
Matrix symmetry type property.
Definition api.h:457
FILE * pastix_fopenw(const char *dirname, const char *filename, const char *mode)
Open a file in the unique directory of the pastix instance.
Definition api.c:251
#define PastixHermitian
Definition api.h:460
int pastixBlasSetNumThreads(int nt)
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) and return the previous number of blas...
Definition api.c:1147
void pastix_gendirectories(pastix_data_t *pastix_data)
Generate a unique temporary directory to store output files.
Definition api.c:85
@ PastixFactLDLH
Definition api.h:319
@ PastixFactLDLT
Definition api.h:316
@ PastixFactLLH
Definition api.h:315
@ PastixFactLU
Definition api.h:317
@ PastixFactLLT
Definition api.h:318
@ DPARM_FACT_THFLOPS
Definition api.h:172
@ DPARM_EPSILON_MAGN_CTRL
Definition api.h:163
@ DPARM_A_NORM
Definition api.h:183
@ DPARM_MEM_FR
Definition api.h:175
@ DPARM_FACT_TIME
Definition api.h:170
@ DPARM_FACT_RLFLOPS
Definition api.h:173
@ DPARM_MEM_LR
Definition api.h:176
@ DPARM_COMPRESS_TOLERANCE
Definition api.h:184
@ DPARM_FACT_FLOPS
Definition api.h:171
@ DPARM_FACT_ENERGY
Definition api.h:174
@ DPARM_COMPRESS_MIN_RATIO
Definition api.h:185
@ PastixLCoef
Definition api.h:478
@ PastixLUCoef
Definition api.h:480
@ PastixCompressWhenBegin
Definition api.h:386
@ PastixCompressWhenEnd
Definition api.h:387
@ PastixCompressNever
Definition api.h:385
@ PastixCompressWhenDuring
Definition api.h:388
@ IPARM_FACTORIZATION
Definition api.h:99
@ IPARM_COMPRESS_WHEN
Definition api.h:131
@ IPARM_COMPRESS_MIN_WIDTH
Definition api.h:129
@ IPARM_MIXED
Definition api.h:139
@ IPARM_FREE_CSCUSER
Definition api.h:102
@ IPARM_STATIC_PIVOTING
Definition api.h:101
@ IPARM_COMPRESS_MIN_HEIGHT
Definition api.h:130
@ IPARM_COMPRESS_ILUK
Definition api.h:136
@ IPARM_SCHEDULER
Definition api.h:117
@ IPARM_COMPRESS_METHOD
Definition api.h:132
@ IPARM_VERBOSE
Definition api.h:36
@ IPARM_COMPRESS_ORTHO
Definition api.h:133
@ IPARM_COMPRESS_RELTOL
Definition api.h:134
@ IPARM_TRACE
Definition api.h:44
@ IPARM_COMPRESS_PRESELECT
Definition api.h:135
@ PastixVerboseNot
Definition api.h:220
@ PastixVerboseNo
Definition api.h:221
@ PastixSchedDynamic
Definition api.h:338
@ PastixSchedStarPU
Definition api.h:337
@ PastixSchedParsec
Definition api.h:336
@ PASTIX_SUCCESS
Definition api.h:367
@ PASTIX_ERR_BADPARAMETER
Definition api.h:374
@ PastixTraceNumfact
Definition api.h:211
int pastix_subtask_sopalin(pastix_data_t *pastix_data)
Factorize the given problem using Cholesky or LU decomposition.
int pastix_subtask_spm2bcsc(pastix_data_t *pastix_data, spmatrix_t *spm)
Fill the internal block CSC structure.
int pastix_subtask_bcsc2ctab(pastix_data_t *pastix_data)
Fill the internal solver matrix structure.
void parsec_sparse_matrix_init(SolverMatrix *solvmtx, int typesize, pastix_mtxtype_t mtxtype, int nodes, int myrank)
Generate the PaRSEC descriptor of the sparse matrix.
void pastix_parsec_init(pastix_data_t *pastix, int *argc, char **argv[], const int *bindtab)
Startup the PaRSEC runtime system.
Definition parsec.c:61
void starpu_sparse_matrix_init(SolverMatrix *solvmtx, pastix_mtxtype_t mtxtype, int nodes, int myrank, pastix_coeftype_t flttype)
Generate the StarPU descriptor of the sparse matrix.
int inter_node_procnum
Definition pastixdata.h:84
pastix_model_t * cpu_models
Definition pastixdata.h:107
pastix_model_t * gpu_models
Definition pastixdata.h:108
SolverMatrix * solvmatr
Definition pastixdata.h:103
int inter_node_procnbr
Definition pastixdata.h:83
pastix_scheduler_t sched
Definition pastixdata.h:74
SolverMatrix * solvglob
Definition pastixdata.h:105
void * parsec
Definition pastixdata.h:87
SolverMatrix * solvloc
Definition pastixdata.h:104
pastix_order_t * ordemesh
Definition pastixdata.h:98
pastix_int_t * iparm
Definition pastixdata.h:70
char * dir_local
Definition pastixdata.h:111
double * dparm
Definition pastixdata.h:71
PASTIX_Comm inter_node_comm
Definition pastixdata.h:78
pastix_bcsc_t * bcsc
Definition pastixdata.h:102
pastix_int_t steps
Definition pastixdata.h:73
int pastix_task_numfact(pastix_data_t *pastix_data, spmatrix_t *spm)
Perform all the numerical factorization steps: fill the internal block CSC and the solver matrix stru...
Main PaStiX data structure.
Definition pastixdata.h:68
void sopalin_cgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_chetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_cpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_cpxtrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_csytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_dsytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_sgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_spotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_ssytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zgetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zhetrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zpotrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zpxtrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
void sopalin_zsytrf(pastix_data_t *pastix_data, sopalin_data_t *sopalin_data)
TODO.
pastix_coeftype_t flttype
Definition solver.h:231
pastix_lr_t lowrank
Definition solver.h:236
pastix_factotype_t factotype
Definition solver.h:237