PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
bcsc.h
Go to the documentation of this file.
1/**
2 *
3 * @file bcsc.h
4 *
5 * @copyright 2004-2025 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
6 * Univ. Bordeaux. All rights reserved.
7 *
8 * @version 6.4.0
9 * @author Mathieu Faverge
10 * @author Pierre Ramet
11 * @author Xavier Lacoste
12 * @author Alycia Lisito
13 * @date 2024-07-05
14 *
15 * @addtogroup bcsc
16 * @{
17 * @brief Describe all the internals routines to manipulate the internal block csc.
18 *
19 * These functions provide a set of subroutines to manipulate the permuted
20 * sparse matrix stored in block of columns following the partition.
21 *
22 **/
23#ifndef _bcsc_h_
24#define _bcsc_h_
25
26/**
27 * @brief Tags used in MPI communications.
28 */
29typedef enum bcsc_tag_ {
30 PastixTagCountA,
31 PastixTagCountAt,
32 PastixTagCountAAt,
33 PastixTagIndexesA,
34 PastixTagIndexesAt,
35 PastixTagIndexesAAt,
36 PastixTagValuesA,
37 PastixTagValuesAt,
38 PastixTagValuesAAt,
39 PastixTagMemSendIdx,
40 PastixTagMemRecvIdx,
41 PastixTagMemSend,
42 PastixTagMemRecvAAt,
43 PastixTagMemSendValA,
44 PastixTagMemSendValAt,
45 PastixTagMemSendValAAt,
46 PastixTagMemRecvIdxA,
47 PastixTagMemRecvIdxAt,
48 PastixTagMemRecvIdxAAt,
49 PastixTagMemRecvValAAt,
51
52/**
53 * @brief Information about the amount of data.
54 */
55typedef struct bcsc_data_amount_s
56{
57 pastix_int_t idxcnt; /**< Amount of indexes of A or At which will be exchanged. */
58 pastix_int_t valcnt; /**< Amount of values of A or At which will be exchanged. */
60
61/**
62 * @brief Information about the sending data.
63 */
64typedef struct bcsc_exch_comm_s
65{
66 bcsc_data_amount_t size; /**< Amount of indexes of A which will be send to clustnum. */
67 pastix_int_t *idxbuf; /**< Array of indexes of A to send to clustnum. */
68 /* indexes_A[2*k] = kth column index to send to proc clustnum. */
69 /* indexes_A[2*k+1] = kth row index to send to proc clustnum. */
70 void *valbuf; /**< Array of values of A to send to clustnum. */
71 /* values_A is sorted the same way as the indexes_A, for each indexes */
72 /* there are dofi*dofj values. */
74
75/**
76 * @brief Informations of the data exchanged with other processors.
77 */
78typedef struct bcsc_proc_comm_s
79{
80 bcsc_exch_comm_t sendA; /**< Sending data of A. */
81 bcsc_exch_comm_t sendAt; /**< Sending data of At. */
82 bcsc_exch_comm_t sendAAt; /**< Sending data of A and At. */
83 bcsc_data_amount_t recvA; /**< Receving data of A. */
84 bcsc_data_amount_t recvAt; /**< Receving data of At. */
85 bcsc_exch_comm_t recvAAt; /**< Receving data of A and At. */
87
88/**
89 * @brief Structure to manage communications with distributed spm.
90 */
91typedef struct bcsc_handle_comm_s
92{
93 pastix_int_t clustnbr; /**< Number of processes in the cluster. */
94 pastix_int_t clustnum; /**< ID of the current process in the cluster. */
95 PASTIX_Comm comm; /**< PaStiX MPI communicator used for the ordering step. */
96 pastix_coeftype_t flttype; /**< valtab datatype: PastixFloat, PastixDouble, PastixComplex32 or PastixComplex64 */
97 pastix_int_t max_idx; /**< Maximum amount of indexes received, used to allocate the receiving buffer. */
98 pastix_int_t max_val; /**< Maximum amount of values received, used to allocate the receiving buffer. */
99 bcsc_proc_comm_t data_comm[1]; /**< Array of size clustnbr. */
100 /* data_comm[c]: contains the data clustnum has to send to c */
101 /* and the amount of data clustnum will receive */
102 /* from c. */
103 /* data_comm[clustnum]: contains the data clustnum will recevied */
104 /* from the other processors. */
106
107/**
108 * @brief Compressed colptr format for the bcsc
109 */
110typedef struct bcsc_cblk_s {
111 pastix_int_t colnbr; /**< Number of columns in the block column. */
112 pastix_int_t cblknum; /**< Index of the corresponding cblk in the local solver matrix */
113 pastix_int_t *coltab; /**< Array of indexes of the start of each column in the row and value arrays. */
115
116/**
117 * @brief Internal column block distributed CSC matrix.
118 */
120 pastix_int_t gN; /**< Global number of vertices */
121 pastix_int_t n; /**< Local number of vertices */
122 pastix_mtxtype_t mtxtype; /**< Matrix structure: PastixGeneral, PastixSymmetric or PastixHermitian. */
123 pastix_coeftype_t flttype; /**< valtab datatype: PastixFloat, PastixDouble, PastixComplex32 or PastixComplex64 */
124 pastix_int_t cscfnbr; /**< Number of column blocks. */
125 bcsc_cblk_t *cscftab; /**< Array of Block column structures of size cscfnbr. (pastix_bcscFormat_t) */
126 pastix_int_t *rowtab; /**< Array of rows in the matrix. */
127 void *Lvalues; /**< Array of values of the matrix A */
128 void *Uvalues; /**< Array of values of the matrix A^t */
129 pastix_int_t *col2cblk; /**< Array which gives the repartition of the solvmtx columns into the block structure. */
130 /* If the column k belongs to a remote block then col2cblk[k] = -(owner_proc + 1). */
131 /* If the column k belongs to a local block then col2cblk[k] = block_num. */
132 bcsc_handle_comm_t *bcsc_comm; /**< Structure which handles the MPI communication (= NULL if PASTIX_WITH_MPI=OFF). */
133};
134
135double bcscInit( const spmatrix_t *spm,
136 const pastix_order_t *ord,
137 const SolverMatrix *solvmtx,
138 pastix_int_t initAt,
139 pastix_bcsc_t *bcsc );
140
141void bcscExit( pastix_bcsc_t *bcsc );
142
143/**
144 * @}
145 *
146 * @addtogroup bcsc_internal
147 * @{
148 */
149void bcsc_init_struct( const spmatrix_t *spm,
150 const SolverMatrix *solvmtx,
151 pastix_bcsc_t *bcsc );
152void bcsc_exit_struct( pastix_bcsc_t *bcsc );
153pastix_int_t bcsc_init_coltab( const spmatrix_t *spm,
154 const pastix_order_t *ord,
155 const SolverMatrix *solvmtx,
156 pastix_bcsc_t *bcsc );
157void bcsc_restore_coltab( pastix_bcsc_t *bcsc );
159 const pastix_bcsc_t *bcsc );
161 const pastix_bcsc_t *bcsc,
162 const spmatrix_t *spm );
163
164void bcsc_handle_comm_init( const SolverMatrix *solvmtx,
165 pastix_bcsc_t *bcsc );
167
168#if defined(PASTIX_WITH_MPI)
169int bcsc_allocate_buf( bcsc_handle_comm_t *bcsc_comm,
170 bcsc_tag_e mode );
171int bcsc_free_buf( bcsc_handle_comm_t *bcsc_comm,
172 bcsc_tag_e mode );
173void bcsc_exchange_amount_of_data( bcsc_handle_comm_t *bcsc_comm );
174void bcsc_exchange_indexes( bcsc_handle_comm_t *bcsc_comm );
175pastix_int_t * bcsc_init_col2cblk_dst( const SolverMatrix *solvmtx,
176 const pastix_bcsc_t *bcsc );
177#endif
178
179/**
180 * @}
181 */
182#endif /* _bcsc_h_ */
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
void bcsc_restore_coltab(pastix_bcsc_t *bcsc)
Restores the coltab array when it has been modified to initialize the row and values arrays.
Definition bcsc.c:1700
void bcsc_init_struct(const spmatrix_t *spm, const SolverMatrix *solvmtx, pastix_bcsc_t *bcsc)
Initializes a block csc.
Definition bcsc.c:1739
pastix_int_t bcsc_init_coltab(const spmatrix_t *spm, const pastix_order_t *ord, const SolverMatrix *solvmtx, pastix_bcsc_t *bcsc)
Initializes the coltab of a block csc matrix. The coltab corresponds to the number of rows (expended)...
Definition bcsc.c:1616
pastix_int_t * bcsc_init_col2cblk(const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc, const spmatrix_t *spm)
Creates the array which represents the repartition of each column in the block structure....
Definition bcsc.c:721
void bcsc_handle_comm_init(const SolverMatrix *solvmtx, pastix_bcsc_t *bcsc)
Initializes the bcsc_handle_comm_t structure.
Definition bcsc.c:48
pastix_int_t * bcsc_init_col2cblk_shm(const SolverMatrix *solvmtx, const pastix_bcsc_t *bcsc)
Creates the array which represents the repartition of each column in the block structure....
Definition bcsc.c:522
void bcsc_exit_struct(pastix_bcsc_t *bcsc)
Cleanup the bcsc struct. (symmetric of bcsc_init_struct)
Definition bcsc.c:1781
void bcsc_handle_comm_exit(bcsc_handle_comm_t *bcsc_comm)
Frees the bcsc_handle_comm pointers.
Definition bcsc.c:79
bcsc_data_amount_t recvA
Definition bcsc.h:83
bcsc_exch_comm_t recvAAt
Definition bcsc.h:85
pastix_int_t max_idx
Definition bcsc.h:97
bcsc_exch_comm_t sendAt
Definition bcsc.h:81
pastix_int_t * rowtab
Definition bcsc.h:126
PASTIX_Comm comm
Definition bcsc.h:95
pastix_int_t idxcnt
Definition bcsc.h:57
pastix_int_t colnbr
Definition bcsc.h:111
pastix_int_t * col2cblk
Definition bcsc.h:129
bcsc_exch_comm_t sendA
Definition bcsc.h:80
void * Lvalues
Definition bcsc.h:127
bcsc_data_amount_t size
Definition bcsc.h:66
pastix_int_t clustnum
Definition bcsc.h:94
bcsc_proc_comm_t data_comm[1]
Definition bcsc.h:99
pastix_int_t * idxbuf
Definition bcsc.h:67
bcsc_handle_comm_t * bcsc_comm
Definition bcsc.h:132
pastix_int_t * coltab
Definition bcsc.h:113
pastix_int_t gN
Definition bcsc.h:120
pastix_int_t cscfnbr
Definition bcsc.h:124
bcsc_data_amount_t recvAt
Definition bcsc.h:84
pastix_int_t n
Definition bcsc.h:121
pastix_coeftype_t flttype
Definition bcsc.h:123
bcsc_cblk_t * cscftab
Definition bcsc.h:125
bcsc_exch_comm_t sendAAt
Definition bcsc.h:82
pastix_int_t valcnt
Definition bcsc.h:58
pastix_coeftype_t flttype
Definition bcsc.h:96
pastix_int_t cblknum
Definition bcsc.h:112
void * valbuf
Definition bcsc.h:70
pastix_int_t clustnbr
Definition bcsc.h:93
pastix_int_t max_val
Definition bcsc.h:98
void * Uvalues
Definition bcsc.h:128
pastix_mtxtype_t mtxtype
Definition bcsc.h:122
struct bcsc_exch_comm_s bcsc_exch_comm_t
Information about the sending data.
struct bcsc_data_amount_s bcsc_data_amount_t
Information about the amount of data.
enum bcsc_tag_ bcsc_tag_e
Tags used in MPI communications.
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
struct bcsc_cblk_s bcsc_cblk_t
Compressed colptr format for the bcsc.
struct bcsc_handle_comm_s bcsc_handle_comm_t
Structure to manage communications with distributed spm.
struct bcsc_proc_comm_s bcsc_proc_comm_t
Informations of the data exchanged with other processors.
void bcscExit(pastix_bcsc_t *bcsc)
Frees the block csc structure but do not free the bcsc pointer.
Definition bcsc.c:1929
bcsc_tag_
Tags used in MPI communications.
Definition bcsc.h:29
Compressed colptr format for the bcsc.
Definition bcsc.h:110
Information about the amount of data.
Definition bcsc.h:56
Information about the sending data.
Definition bcsc.h:65
Structure to manage communications with distributed spm.
Definition bcsc.h:92
Informations of the data exchanged with other processors.
Definition bcsc.h:79
Internal column block distributed CSC matrix.
Definition bcsc.h:119
spm_coeftype_t pastix_coeftype_t
Arithmetic types.
Definition api.h:294
spm_mtxtype_t pastix_mtxtype_t
Matrix symmetry type property.
Definition api.h:457
Order structure.
Definition order.h:47
Solver column block structure.
Definition solver.h:203