PaStiX Handbook  6.3.2
coeftab_zcinit.c
Go to the documentation of this file.
1 /**
2  *
3  * @file coeftab_zcinit.c
4  *
5  * Mixed-Precision dependent coeficient array initialization routines.
6  *
7  * @copyright 2015-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Xavier Lacoste
12  * @author Pierre Ramet
13  * @author Mathieu Faverge
14  * @author Esragul Korkmaz
15  * @author Brieuc Nicolas
16  * @date 2023-07-21
17  *
18  * @generated from /builds/solverstack/pastix/sopalin/coeftab_zcinit.c, mixed zc -> zc, Wed Dec 13 12:09:47 2023
19  *
20  **/
21 #ifndef DOXYGEN_SHOULD_SKIP_THIS
22 #define _GNU_SOURCE 1
23 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
24 #include "common.h"
25 #include "blend/solver.h"
26 #include "bcsc/bcsc.h"
27 #include "sopalin/coeftab.h"
28 #include "sopalin/coeftab_z.h"
29 #include "sopalin/coeftab_c.h"
30 #include "pastix_zccores.h"
31 #include "pastix_ccores.h"
32 
33 /**
34  *******************************************************************************
35  *
36  * @brief Fully initialize a single mixed-precision cblk.
37  *
38  * The cblk is allocated, intialized from the bcsc, and compressed if necessary.
39  *
40  *******************************************************************************
41  *
42  * @param[in] side
43  * Define which side of the matrix must be initialized.
44  * @arg PastixLCoef if lower part only
45  * @arg PastixUCoef if upper part only
46  * @arg PastixLUCoef if both sides.
47  *
48  * @param[in] solvmtx
49  * The solver matrix data structure.
50  *
51  * @param[in] bcsc
52  * The internal block CSC structure to fill-in the matrix.
53  *
54  * @param[in] itercblk
55  * The index of the cblk to initialize.
56  *
57  * @param[inout] directory
58  * The pointer to the temporary directory where to store the output
59  * files. Used only if PASTIX_DEBUG_DUMP_COEFTAB is defined.
60  *
61  *******************************************************************************/
62 void
64  const SolverMatrix *solvmtx,
65  const pastix_bcsc_t *bcsc,
66  pastix_int_t itercblk,
67  const char *directory )
68 {
69  SolverCblk *cblk = solvmtx->cblktab + itercblk;
70  int ilukmax = solvmtx->lowrank.ilu_lvl;
71  int rc;
72 
73  /* Do not allocate if already allocated */
74  if ( !solvmtx->globalalloc ) {
75  cpucblk_calloc( side, cblk );
76  }
77 
78  rc = cpucblk_zcfillin( side, solvmtx, bcsc, itercblk );
79  if( rc != 0 ) {
80  pastix_print_error("cpucblk_zcinit: mixed-precision overflow during the matrix initialization");
81  return;
82  }
83 
84 #if defined(PASTIX_DEBUG_DUMP_COEFTAB)
85  /*
86  * Rk: This function is not in the kernel directory to avoid the double
87  * dependency with the pastix library due to pastix_fopenw()
88  */
89  {
90  cpucblk_cdumpfile(side, cblk, itercblk, directory);
91  }
92 #endif /* defined(PASTIX_DEBUG_DUMP_COEFTAB) */
93 
94  /* Update ILU levels if needed */
95  if ( (ilukmax > 0) && (ilukmax < INT_MAX) ) {
96 #if defined(PASTIX_WITH_MPI)
97  /* For now, we can't compute ILU(k) levels in distributed */
98  if ( solvmtx->clustnbr == 1 )
99 #endif
100  {
101  do { pastix_yield(); } while( cblk->ctrbcnt > 0 );
102  coeftabComputeCblkILULevels( solvmtx, cblk );
103  }
104  }
105 
106  /**
107  * Try to compress the cblk if needs to be compressed
108  */
109  if ( (cblk->cblktype & CBLK_COMPRESSED) &&
110  (ilukmax < INT_MAX) )
111  {
112  cpucblk_ccompress( solvmtx, side, ilukmax, cblk );
113  }
114 
115  (void)directory;
116 }
void cpucblk_zcinit(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk, const char *directory)
Fully initialize a single mixed-precision cblk.
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
void coeftabComputeCblkILULevels(const SolverMatrix *solvmtx, SolverCblk *cblk)
Compute the ILU levels of a cblk.
Definition: coeftab.c:456
void cpucblk_cdumpfile(pastix_coefside_t side, SolverCblk *cblk, pastix_int_t itercblk, const char *directory)
Dump a single column block into a FILE in a human readale format.
Definition: coeftab_c.c:125
void cpucblk_calloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
pastix_int_t cpucblk_ccompress(const SolverMatrix *solvmtx, pastix_coefside_t side, int max_ilulvl, SolverCblk *cblk)
Compress a single column block from full-rank to low-rank format.
enum pastix_coefside_e pastix_coefside_t
Data blocks used in the kernel.
int cpucblk_zcfillin(pastix_coefside_t side, const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, pastix_int_t itercblk)
Initialize the coeftab structure from the internal bcsc.
pastix_lr_t lowrank
Definition: solver.h:230
int globalalloc
Definition: solver.h:226
volatile int32_t ctrbcnt
Definition: solver.h:158
SolverCblk *restrict cblktab
Definition: solver.h:222
int8_t cblktype
Definition: solver.h:159
Solver column block structure.
Definition: solver.h:156
Solver column block structure.
Definition: solver.h:200