7.0
general documentation
cs_numbering.h
Go to the documentation of this file.
1 #ifndef __CS_NUMBERING_H__
2 #define __CS_NUMBERING_H__
3 
4 /*============================================================================
5  * Numbering information for vectorization or multithreading
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 #include "cs_base.h"
36 #include "cs_log.h"
37 
38 /*----------------------------------------------------------------------------*/
39 
41 
42 /*============================================================================
43  * Macro definitions
44  *============================================================================*/
45 
46 /* SIMD unit length */
47 /*------------------*/
48 
49 #if defined(__NEC__) && defined(__ve__) /* For NEC Aurora series */
50 
51 # define CS_NUMBERING_SIMD_SIZE 256
52 
53 #elif defined(SX) && defined(_SX) /* For NEC SX series (at least SX-9) */
54 
55 # define CS_NUMBERING_SIMD_SIZE 256
56 
57 #elif defined(__AVX512F__) /* For Intel with AVX 512 */
58 
59 # define CS_NUMBERING_SIMD_SIZE 64
60 
61 #else
62 
63 # define CS_NUMBERING_SIMD_SIZE 4 /* Most current platforms */
64 
65 #endif
66 
67 /*============================================================================
68  * Type definitions
69  *============================================================================*/
70 
71 /* Renumbering types */
72 
73 typedef enum {
74 
75  CS_NUMBERING_DEFAULT, /* Default numbering */
76  CS_NUMBERING_VECTORIZE, /* Numbered for vectorization */
77  CS_NUMBERING_THREADS /* Numbered for threads */
78 
80 
81 /* Renumbering structure */
82 
83 typedef struct {
84 
85  cs_numbering_type_t type; /* Numbering type */
86 
87  int vector_size; /* Vector size if vectorized, 1 otherwise */
88 
89  int n_threads; /* Number of threads */
90  int n_groups; /* Number of associated groups */
91 
92  int n_no_adj_halo_groups; /* number of groups for which only non-ghost
93  entities are adjacent */
94 
95  cs_lnum_t n_no_adj_halo_elts; /* Number of elements not adjacent to
96  halo elements */
97 
98  cs_lnum_t *group_index; /* For thread t and group g, the start and
99  past-the-end ids for entities in a given
100  group and thread are respectively:
101  group_index[t*n_groups*2 + g] and
102  group_index[t*n_groups*2 + g + 1].
103  (size: n_groups * n_threads * 2) */
104 
106 
107 /*=============================================================================
108  * Global variable definitions
109  *============================================================================*/
110 
111 /* Names for numbering types */
112 
113 extern const char *cs_numbering_type_name[];
114 
115 /*============================================================================
116  * Public function prototypes for Fortran API
117  *============================================================================*/
118 
119 /*=============================================================================
120  * Public function prototypes
121  *============================================================================*/
122 
123 /*----------------------------------------------------------------------------*/
131 /*----------------------------------------------------------------------------*/
132 
135 
136 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
150  int vector_size);
151 
152 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
170 cs_numbering_create_threaded(int n_threads,
171  int n_groups,
172  cs_lnum_t group_index[]);
173 
174 /*----------------------------------------------------------------------------*/
181 /*----------------------------------------------------------------------------*/
182 
183 void
185 
186 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 void
198  const char *description,
199  const cs_numbering_t *numbering);
200 
201 /*----------------------------------------------------------------------------*/
207 /*----------------------------------------------------------------------------*/
208 
209 void
210 cs_numbering_dump(const cs_numbering_t *numbering);
211 
212 /*----------------------------------------------------------------------------*/
213 
215 
216 #endif /* __CS_NUMBERING_H__ */
cs_numbering_type_t type
Definition: cs_numbering.h:85
const char * cs_numbering_type_name[]
Definition: cs_numbering.c:73
int n_no_adj_halo_groups
Definition: cs_numbering.h:92
void cs_numbering_destroy(cs_numbering_t **numbering)
Destroy a numbering information structure.
Definition: cs_numbering.c:635
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
Definition: cs_numbering.h:77
cs_numbering_t * cs_numbering_create_threaded(int n_threads, int n_groups, cs_lnum_t group_index[])
Create a default numbering information structure in case of threading.
Definition: cs_numbering.c:598
cs_numbering_t * cs_numbering_create_vectorized(cs_lnum_t n_elts, int vector_size)
Create a default numbering information structure in case of vectorization.
Definition: cs_numbering.c:556
void cs_numbering_log_info(cs_log_t log, const char *description, const cs_numbering_t *numbering)
Log information relative to a cs_numbering_t structure.
Definition: cs_numbering.c:658
Definition: cs_numbering.h:76
cs_lnum_t * group_index
Definition: cs_numbering.h:98
int vector_size
Definition: cs_numbering.h:87
Definition: cs_numbering.h:75
cs_log_t
Definition: cs_log.h:48
int n_groups
Definition: cs_numbering.h:90
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
void cs_numbering_dump(const cs_numbering_t *numbering)
Dump a cs_numbering_t structure.
Definition: cs_numbering.c:746
#define END_C_DECLS
Definition: cs_defs.h:496
int n_threads
Definition: cs_numbering.h:89
cs_numbering_type_t
Definition: cs_numbering.h:73
cs_lnum_t n_no_adj_halo_elts
Definition: cs_numbering.h:95
cs_numbering_t * cs_numbering_create_default(cs_lnum_t n_elts)
Create a default numbering information structure.
Definition: cs_numbering.c:520
Definition: cs_numbering.h:83