PaStiX Handbook  6.3.2
bvec.h
Go to the documentation of this file.
1 /**
2  *
3  * @file bvec.h
4  *
5  * @copyright 2004-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
6  * Univ. Bordeaux. All rights reserved.
7  *
8  * @version 6.3.2
9  * @author Mathieu Faverge
10  * @author Pierre Ramet
11  * @author Xavier Lacoste
12  * @author Vincent Bridonneau
13  * @author Alycia Lisito
14  * @date 2023-07-21
15  *
16  * @addtogroup bcsc
17  * @{
18  *
19  **/
20 #ifndef _bvec_h_
21 #define _bvec_h_
22 
23 #include <stdlib.h>
24 
25 /**
26  * @brief Tags used in MPI communications.
27  */
28 typedef enum bvec_tag_ {
29  PastixTagAmount,
30  PastixTagIndexes,
31  PastixTagValues,
33 
34 /**
35  * @brief Information about the amount of data exchanged to permute the pivots.
36  */
37 typedef struct bvec_data_amount_s
38 {
39  /* WARNING: the two counters must remain at the head of the structure to exchange
40  the volume of the communications between the processes. */
41  pastix_int_t idxcnt; /**< Amount of indexes of b or x which will be exchanged. */
42  pastix_int_t valcnt; /**< Amount of values of b or x which will be exchanged. */
44 
45 /**
46  * @brief Informations of the data exchanged with other processes.
47  */
48 typedef struct bvec_proc_comm_s
49 {
50  bvec_data_amount_t nsends; /**< Number of indexes and values to send to clustnum. */
51  bvec_data_amount_t nrecvs; /**< Number of indexes and values to receive from clustnum. */
52  pastix_int_t *send_idxbuf; /**< Array of indexes of b or x to exchange. */
53  void *send_valbuf; /**< Array of values of b or x to exchange. */
54  /* The indexes and values array are sorted the following way: */
55  /* k is incremented -> k += dofk * j. */
56  /* indexes[k] = i. */
57  /* array[k] -> corresponds to (i, 0). */
58  /* array[k + dofk * j] -> corresponds to (i, j). */
59  /* array[k + h + dofk * j] -> corresponds to (i + h, j). */
61 
62 /**
63  * @brief Structure to manage communications with distributed rhs.
64  */
65 typedef struct bvec_handle_comm_s
66 {
67  pastix_int_t clustnbr; /**< Number of processes in the communicator. */
68  pastix_int_t clustnum; /**< ID of the current process in the communicator. */
69  PASTIX_Comm comm; /**< PaStiX MPI communicator used for the ordering step. */
70  pastix_coeftype_t flttype; /**< valtab datatype: PastixFloat, PastixDouble, PastixComplex32 or PastixComplex64 */
71  pastix_int_t max_idx; /**< Maximum amount of indexes received, used to allocate the receiving buffer. */
72  pastix_int_t max_val; /**< Maximum amount of values received, used to allocate the receiving buffer. */
73  bvec_proc_comm_t data_comm[1]; /**< Array of size clustnbr. */
74  /* data_comm[c]: contains the data clustnum has to send to c in */
75  /* the distributed case and the amount of data */
76  /* clustnum will receive from c. */
77  /* data_comm[clustnum]: contains the data clustnum will send */
78  /* to the other processors in the replicated */
79  /* case and is NULL in the distributed case. */
81 
82 void *bvec_malloc( size_t size );
83 void bvec_free( void *x );
84 
85 #if defined( PASTIX_WITH_MPI )
86 int bvec_handle_comm_init( const pastix_data_t *pastix_data,
87  pastix_rhs_t Pb );
88 int bvec_handle_comm_exit( bvec_handle_comm_t *rhs_comm );
89 
90 pastix_int_t bvec_glob2Ploc( const pastix_data_t *pastix_data,
91  pastix_int_t ig );
92 pastix_int_t bvec_Pglob2loc( const pastix_data_t *pastix_data,
93  const pastix_int_t *glob2loc,
94  pastix_int_t igp );
95 int bvec_compute_Ploc2Pglob( pastix_data_t *pastix_data,
96  pastix_rhs_t Pb );
97 
98 int bvec_exchange_amount_rep( bvec_handle_comm_t *rhs_comm );
99 int bvec_exchange_amount_dst( pastix_data_t *pastix_data,
100  pastix_dir_t dir,
101  pastix_int_t m,
102  pastix_int_t nrhs,
103  pastix_rhs_t Pb );
104 #endif
105 
106 #endif /* _bvec_h_ */
107 /**
108  * @}
109  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
pastix_int_t max_idx
Definition: bvec.h:71
pastix_int_t valcnt
Definition: bvec.h:42
pastix_int_t max_val
Definition: bvec.h:72
pastix_int_t idxcnt
Definition: bvec.h:41
pastix_int_t * send_idxbuf
Definition: bvec.h:52
bvec_data_amount_t nrecvs
Definition: bvec.h:51
bvec_data_amount_t nsends
Definition: bvec.h:50
pastix_int_t clustnbr
Definition: bvec.h:67
void * send_valbuf
Definition: bvec.h:53
pastix_int_t clustnum
Definition: bvec.h:68
PASTIX_Comm comm
Definition: bvec.h:69
pastix_coeftype_t flttype
Definition: bvec.h:70
bvec_proc_comm_t data_comm[1]
Definition: bvec.h:73
void bvec_free(void *x)
Free a vector.
Definition: bvec.c:62
struct bvec_proc_comm_s bvec_proc_comm_t
Informations of the data exchanged with other processes.
enum bvec_tag_ bvec_tag_e
Tags used in MPI communications.
void * bvec_malloc(size_t size)
Allocate a vector.
Definition: bvec.c:42
struct bvec_handle_comm_s bvec_handle_comm_t
Structure to manage communications with distributed rhs.
struct bvec_data_amount_s bvec_data_amount_t
Information about the amount of data exchanged to permute the pivots.
bvec_tag_
Tags used in MPI communications.
Definition: bvec.h:28
Information about the amount of data exchanged to permute the pivots.
Definition: bvec.h:38
Structure to manage communications with distributed rhs.
Definition: bvec.h:66
Informations of the data exchanged with other processes.
Definition: bvec.h:49
spm_coeftype_t pastix_coeftype_t
Arithmetic types.
Definition: api.h:294
enum pastix_dir_e pastix_dir_t
Direction.
Main PaStiX data structure.
Definition: pastixdata.h:67
Main PaStiX RHS structure.
Definition: pastixdata.h:150