PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
coeftab_dsinit.c
Go to the documentation of this file.
1/**
2 *
3 * @file coeftab_dsinit.c
4 *
5 * Mixed-Precision dependent coeficient array initialization routines.
6 *
7 * @copyright 2015-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 6.4.0
11 * @author Xavier Lacoste
12 * @author Pierre Ramet
13 * @author Mathieu Faverge
14 * @author Esragul Korkmaz
15 * @author Brieuc Nicolas
16 * @date 2024-07-05
17 *
18 * @generated from /builds/2mk6rsew/0/solverstack/pastix/sopalin/coeftab_zcinit.c, mixed zc -> ds, Tue Feb 25 14:36:04 2025
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_d.h"
29#include "sopalin/coeftab_s.h"
30#include "pastix_dscores.h"
31#include "pastix_scores.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 *******************************************************************************/
62void
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_salloc( side, cblk );
76 }
77
78 rc = cpucblk_dsfillin( side, solvmtx, bcsc, itercblk );
79 if( rc != 0 ) {
80 pastix_print_error("cpucblk_dsinit: 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_sdumpfile(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_scompress( solvmtx, side, ilukmax, cblk );
113 }
114
115 (void)directory;
116}
void cpucblk_dsinit(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:454
void cpucblk_sdumpfile(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_s.c:125
void cpucblk_salloc(pastix_coefside_t side, SolverCblk *cblk)
Allocate the cblk structure to store the coefficient.
pastix_int_t cpucblk_scompress(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_dsfillin(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:236
volatile int32_t ctrbcnt
Definition solver.h:163
SolverCblk *restrict cblktab
Definition solver.h:228
int8_t cblktype
Definition solver.h:164
Solver column block structure.
Definition solver.h:161
Solver column block structure.
Definition solver.h:203