PaStiX Handbook  6.3.2
d_refine_functions.c
Go to the documentation of this file.
1 /**
2  *
3  * @file d_refine_functions.c
4  *
5  * PaStiX refinement functions implementations.
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 Mathieu Faverge
12  * @author Pierre Ramet
13  * @author Theophile Terraz
14  * @author Xavier Lacoste
15  * @author Gregoire Pichon
16  * @author Tony Delarue
17  * @author Vincent Bridonneau
18  * @date 2023-07-21
19  * @generated from /builds/solverstack/pastix/refinement/z_refine_functions.c, normal z -> d, Wed Dec 13 12:09:46 2023
20  *
21  **/
22 #include "common.h"
23 #include "cblas.h"
24 #include "bcsc/bcsc.h"
25 #include "bcsc/bvec.h"
26 #include "bcsc/bcsc_d.h"
27 #include "sopalin/sopalin_data.h"
29 
30 /**
31  *******************************************************************************
32  *
33  * @ingroup pastix_dev_refine
34  *
35  * @brief Print statistics about one iteration
36  *
37  *******************************************************************************
38  *
39  * @param[in] t0
40  * The clock value at the beginning of the iteration
41  *
42  * @param[in] tf
43  * The clock value at the end of the iteration
44  *
45  * @param[in] err
46  * The backward error after the iteration
47  *
48  * @param[in] nb_iters
49  * Current number of refinement iterations
50  *
51  *******************************************************************************/
53 {
54  pastix_fixdbl_t stt;
55 
56  stt = tf - t0;
57  fprintf(stdout, OUT_ITERREFINE_ITER, (int)nb_iters);
58  fprintf(stdout, OUT_ITERREFINE_TTT, stt);
59  fprintf(stdout, OUT_ITERREFINE_ERR, err);
60 }
61 
62 /**
63  *******************************************************************************
64  *
65  * @ingroup pastix_dev_refine
66  *
67  * @brief Final output
68  *
69  *******************************************************************************
70  *
71  * @param[in] pastix_data
72  * The PaStiX data structure that describes the solver instance.
73  *
74  * @param[in] err
75  * The final backward error
76  *
77  * @param[in] nb_iters
78  * The final number of iterations
79  *
80  * @param[in] tf
81  * The final clock value
82  *
83  * @param[inout] x
84  * The vector that is to be overwritten by gmresx
85  *
86  * @param[in] gmresx
87  * The final solution
88  *
89  *******************************************************************************/
91  double err,
92  pastix_int_t nb_iters,
93  pastix_fixdbl_t tf,
94  void *x,
95  double *gmresx )
96 {
97  (void)pastix_data;
98  (void)err;
99  (void)nb_iters;
100  (void)tf;
101  (void)x;
102  (void)gmresx;
103 }
104 
105 /**
106  *******************************************************************************
107  *
108  * @ingroup pastix_dev_refine
109  *
110  * @brief Initiate functions pointers to define basic operations
111  *
112  *******************************************************************************
113  *
114  * @param[out] solver
115  * The structure to be filled
116  *
117  * @param[in] pastix_data
118  * TODO
119  *
120  *******************************************************************************/
121 void d_refine_init( struct d_solver *solver,
122  pastix_data_t *pastix_data )
123 {
124  pastix_scheduler_t sched = pastix_data->iparm[IPARM_SCHEDULER];
125 
126  /* Allocations */
127  solver->malloc = &bvec_malloc;
128  solver->free = &bvec_free;
129 
130  /* Output */
131  solver->output_oneiter = &d_refine_output_oneiter;
132  solver->output_final = &d_refine_output_final;
133 
134  /* Basic operations */
135  solver->spsv = &bcsc_dspsv;
136  if ( sched == PastixSchedSequential )
137  {
138  solver->spmv = &bcsc_dspmv;
139  solver->copy = &bvec_dcopy_seq;
140  solver->dot = &bvec_ddot_seq;
141  solver->axpy = &bvec_daxpy_seq;
142  solver->scal = &bvec_dscal_seq;
143  solver->norm = &bvec_dnrm2_seq;
144  solver->gemv = &bvec_dgemv_seq;
145  } else {
146  solver->spmv = &bcsc_dspmv;
147  solver->copy = &bvec_dcopy_smp;
148  solver->dot = &bvec_ddot_smp;
149  solver->axpy = &bvec_daxpy_smp;
150  solver->scal = &bvec_dscal_smp;
151  solver->norm = &bvec_dnrm2_smp;
152  solver->gemv = &bvec_dgemv_smp;
153  }
154 }
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
double pastix_fixdbl_t
Definition: datatypes.h:65
void bvec_dgemv_seq(pastix_data_t *pastix_data, pastix_int_t m, pastix_int_t n, double alpha, const double *A, pastix_int_t lda, const double *x, double beta, double *y)
Compute.
void bvec_free(void *x)
Free a vector.
Definition: bvec.c:62
void bvec_daxpy_seq(pastix_data_t *pastix_data, pastix_int_t n, double alpha, const double *x, double *y)
Compute y <- alpha * x + y. (Sequential version)
double bvec_dnrm2_seq(pastix_data_t *pastix_data, pastix_int_t n, const double *x)
Compute the norm 2 of a vector. (Sequential version)
Definition: bvec_dcompute.c:71
double bvec_ddot_smp(pastix_data_t *pastix_data, pastix_int_t n, const double *x, const double *y)
Compute a regular scalar product x.y (Parallel version)
void bvec_dgemv_smp(pastix_data_t *pastix_data, pastix_int_t m, pastix_int_t n, double alpha, const double *A, pastix_int_t lda, const double *x, double beta, double *y)
Compute.
void bvec_daxpy_smp(pastix_data_t *pastix_data, pastix_int_t n, double alpha, const double *x, double *y)
Perform y = alpha * x + y (Parallel version)
void * bvec_malloc(size_t size)
Allocate a vector.
Definition: bvec.c:42
void bvec_dcopy_smp(pastix_data_t *pastix_data, pastix_int_t n, const double *x, double *y)
Copy a vector y = x (parallel version)
void bvec_dcopy_seq(pastix_data_t *pastix_data, pastix_int_t n, const double *x, double *y)
Copy a vector y = x (Sequential version)
void bcsc_dspsv(pastix_data_t *pastix_data, double *b, float *work)
Solve A x = b with A the sparse matrix.
void bvec_dscal_smp(pastix_data_t *pastix_data, pastix_int_t n, double alpha, double *x)
Scale a vector (Parallel version)
void bcsc_dspmv(const pastix_data_t *pastix_data, pastix_trans_t trans, double alpha, const double *x, double beta, double *y)
Compute the matrix-vector product y = alpha * op(A) * x + beta * y.
Definition: bcsc_dspmv.c:629
double bvec_ddot_seq(pastix_data_t *pastix_data, pastix_int_t n, const double *x, const double *y)
Compute the scalar product x.y. (Sequential version)
double bvec_dnrm2_smp(pastix_data_t *pastix_data, pastix_int_t n, const double *x)
Compute the norm 2 of a vector. (Parallel version)
void bvec_dscal_seq(pastix_data_t *pastix_data, pastix_int_t n, double alpha, double *x)
Scale a vector by the scalar alpha. (Sequential version)
enum pastix_scheduler_e pastix_scheduler_t
Scheduler.
@ IPARM_SCHEDULER
Definition: api.h:117
@ PastixSchedSequential
Definition: api.h:334
void d_refine_output_final(pastix_data_t *pastix_data, double err, pastix_int_t nb_iters, pastix_fixdbl_t tf, void *x, double *gmresx)
Final output.
void d_refine_output_oneiter(pastix_fixdbl_t t0, pastix_fixdbl_t tf, double err, pastix_int_t nb_iters)
Print statistics about one iteration.
void d_refine_init(struct d_solver *, pastix_data_t *)
Initiate functions pointers to define basic operations.
pastix_int_t * iparm
Definition: pastixdata.h:69
Main PaStiX data structure.
Definition: pastixdata.h:67