1 #ifndef __CS_PARALL_H__
2 #define __CS_PARALL_H__
84 #if defined(HAVE_MPI_IN_PLACE)
91 MPI_Allreduce(MPI_IN_PLACE, cpt, n,
CS_MPI_GNUM, MPI_SUM,
96 #elif defined(HAVE_MPI)
104 #define cs_parall_counter(_cpt, _n)
117 #if defined(HAVE_MPI_IN_PLACE)
124 MPI_Allreduce(MPI_IN_PLACE, cpt, n,
CS_MPI_LNUM, MPI_MAX,
129 #elif defined(HAVE_MPI)
137 #define cs_parall_counter_max(_cpt, _n)
151 #if defined(HAVE_MPI_IN_PLACE)
164 #elif defined(HAVE_MPI)
173 #define cs_parall_sum(_n, _datatype, _val) { };
188 #if defined(HAVE_MPI_IN_PLACE)
201 #elif defined(HAVE_MPI)
210 #define cs_parall_max(_n, _datatype, _val);
225 #if defined(HAVE_MPI_IN_PLACE)
238 #elif defined(HAVE_MPI)
247 #define cs_parall_min(_n, _datatype, _val);
264 #if defined(HAVE_MPI)
279 #define cs_parall_bcast(_root_rank, _n, _datatype, _val);
477 const float g_array[],
582 #if defined(HAVE_OPENMP)
583 const int t_id = omp_get_thread_num();
584 const int n_t = omp_get_num_threads();
585 const cs_lnum_t t_n = (n + n_t - 1) / n_t;
589 *e_id = (t_id+1) * t_n;
592 if (*e_id > n) *e_id = n;
627 #if defined(HAVE_OPENMP)
628 const int t_id = omp_get_thread_num();
629 const double n_t = omp_get_num_threads();
632 double r0 = (double)t_id / (
double)n_t;
633 double r1 = (double)(t_id+1) / (double)n_t;
645 if (*e_id > n) *e_id = n;
int cs_glob_n_ranks
Definition: cs_defs.c:175
MPI_Datatype cs_datatype_to_mpi[]
Definition: cs_defs.c:157
MPI_Comm cs_glob_mpi_comm
Definition: cs_defs.c:183
cs_datatype_t
Definition: cs_defs.h:272
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define CS_MPI_LNUM
Definition: cs_defs.h:410
#define CS_MPI_GNUM
Definition: cs_defs.h:390
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:298
static cs_lnum_t cs_align(cs_lnum_t i, cs_lnum_t m)
Given a base index i, return the next index aligned with a size m.
Definition: cs_defs.h:613
#define CS_UNUSED(x)
Definition: cs_defs.h:500
#define END_C_DECLS
Definition: cs_defs.h:515
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
#define CS_CL_SIZE
Definition: cs_defs.h:470
void cs_parall_gather_r(int root_rank, int n_elts, int n_g_elts, const cs_real_t array[], cs_real_t g_array[])
Build a global array on the given root rank from all local arrays.
Definition: cs_parall.c:1016
static void cs_parall_bcast(int root_rank, int n, cs_datatype_t datatype, void *val)
Broadcast values of a given datatype to all default communicator processes.
Definition: cs_parall.h:267
void cs_parall_set_min_coll_buf_size(size_t buffer_size)
Define minimum recommended scatter or gather buffer size.
Definition: cs_parall.c:1339
void cs_parall_gather_ordered_r(int root_rank, int n_elts, int n_g_elts, int stride, cs_real_t o_key[], cs_real_t array[], cs_real_t g_array[])
Build an ordered global array on the given root rank from all local arrays.
Definition: cs_parall.c:1083
void cs_parall_min_id_rank_r(cs_lnum_t *elt_id, int *rank_id, cs_real_t val)
Given an (id, rank, value) tuple, return the local id and rank corresponding to the global minimum va...
Definition: cs_parall.c:841
static void cs_parall_thread_range_upper(cs_lnum_t n, size_t type_size, cs_lnum_t *s_id, cs_lnum_t *e_id)
Compute array index bounds for a local thread for upper triangular matrix elements.
Definition: cs_parall.h:622
static void cs_parall_max(int n, cs_datatype_t datatype, void *val)
Maximum values of a given datatype on all default communicator processes.
Definition: cs_parall.h:191
static void cs_parall_counter_max(cs_lnum_t cpt[], const int n)
Maximum values of a counter on all default communicator processes.
Definition: cs_parall.h:120
void cs_parall_allgather_r(int n_elts, int n_g_elts, cs_real_t array[], cs_real_t g_array[])
Build a global array from each local array in each domain.
Definition: cs_parall.c:895
static void cs_parall_counter(cs_gnum_t cpt[], const int n)
Sum values of a counter on all default communicator processes.
Definition: cs_parall.h:87
void cs_parall_scatter_r(int root_rank, int n_elts, int n_g_elts, const cs_real_t g_array[], cs_real_t array[])
Distribute a global array from a given root rank over all ranks. Each rank receive the part related t...
Definition: cs_parall.c:1132
static void cs_parall_sum(int n, cs_datatype_t datatype, void *val)
Sum values of a given datatype on all default communicator processes.
Definition: cs_parall.h:154
void cs_parall_allgather_ordered_r(int n_elts, int n_g_elts, int stride, cs_real_t o_key[], cs_real_t array[], cs_real_t g_array[])
Build an ordered global array from each local array in each domain.
Definition: cs_parall.c:972
void cs_parall_scatter_f(int root_rank, int n_elts, int n_g_elts, const float g_array[], float array[])
Distribute a global array from a given root rank over all ranks. Each rank receive the part related t...
Definition: cs_parall.c:1262
static void cs_parall_thread_range(cs_lnum_t n, size_t type_size, cs_lnum_t *s_id, cs_lnum_t *e_id)
Compute array index bounds for a local thread. When called inside an OpenMP parallel section,...
Definition: cs_parall.h:577
void cs_parall_min_loc_vals(int n, cs_real_t *min, cs_real_t min_loc_vals[])
Minimum value of a real and the value of related array on all default communicator processes.
Definition: cs_parall.c:802
static void cs_parall_min(int n, cs_datatype_t datatype, void *val)
Minimum values of a given datatype on all default communicator processes.
Definition: cs_parall.h:228
void cs_parall_gather_f(int root_rank, int n_elts, int n_g_elts, const float array[], float g_array[])
Build a global array on the given root rank from all local arrays. Function dealing with single-preci...
Definition: cs_parall.c:1197
void cs_parall_max_loc_vals(int n, cs_real_t *max, cs_real_t max_loc_vals[])
Maximum value of a real and the value of related array on all default communicator processes.
Definition: cs_parall.c:764
size_t cs_parall_get_min_coll_buf_size(void)
Return minimum recommended scatter or gather buffer size.
Definition: cs_parall.c:1317
cs_e2n_sum_t
Definition: cs_parall.h:51
@ CS_E2N_SUM_SCATTER_ATOMIC
Definition: cs_parall.h:56
@ CS_E2N_SUM_SCATTER
Definition: cs_parall.h:53
@ CS_E2N_SUM_GATHER
Definition: cs_parall.h:58
cs_e2n_sum_t cs_glob_e2n_sum_type