7.2
general documentation
cs_parall.h File Reference
#include "cs_defs.h"
+ Include dependency graph for cs_parall.h:

Go to the source code of this file.

Functions

static void cs_parall_counter (cs_gnum_t cpt[], const int n)
 Sum values of a counter on all default communicator processes. More...
 
static void cs_parall_counter_max (cs_lnum_t cpt[], const int n)
 Maximum values of a counter on all default communicator processes. More...
 
static void cs_parall_sum (int n, cs_datatype_t datatype, void *val)
 Sum values of a given datatype on all default communicator processes. More...
 
static void cs_parall_max (int n, cs_datatype_t datatype, void *val)
 Maximum values of a given datatype on all default communicator processes. More...
 
static void cs_parall_min (int n, cs_datatype_t datatype, void *val)
 Minimum values of a given datatype on all default communicator processes. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 to its local elements. More...
 
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-precision arrays. More...
 
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 to its local elements. Function dealing with single-precision arrays. More...
 
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. More...
 
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. More...
 
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 value. More...
 
size_t cs_parall_get_min_coll_buf_size (void)
 Return minimum recommended scatter or gather buffer size. More...
 
void cs_parall_set_min_coll_buf_size (size_t buffer_size)
 Define minimum recommended scatter or gather buffer size. More...
 
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, this will return the start an past-the-end indexes for the array range assigned to that thread. In other cases, the start index is 1, and the past-the-end index is n;. More...
 

Function Documentation

◆ cs_parall_allgather_ordered_r()

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.

Local array elements are ordered based on a given key value (usually some form of coordinate, so the result should be independent of partitioning as long as the definition of the o_key array's defintion is itself independent of the partitioning.

Use of this function may be quite practical, but should be limited to user functions, as it may limit scalability (especially as regards memory usage).

Parameters
[in]n_eltsnumber of local elements
[in]n_g_eltsnumber of global elements
[in]stridenumber of values per element
[in]o_keyordering key (coordinate) value per element
[in]arraylocal array (size: n_elts*stride)
[out]g_arrayglobal array (size: n_g_elts*stride)

◆ cs_parall_allgather_r()

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.

Local arrays are appended in order of owning MPI rank. The size of each local array may be different.

Use of this function may be quite practical, but should be limited to user functions, as it may limit scalability (especially as regards memory usage).

Parameters
[in]n_eltssize of the local array
[in]n_g_eltssize of the global array
[in]arraylocal array (size: n_elts)
[out]g_arrayglobal array (size: n_g_elts)

◆ cs_parall_bcast()

static void cs_parall_bcast ( int  root_rank,
int  n,
cs_datatype_t  datatype,
void *  val 
)
inlinestatic

Broadcast values of a given datatype to all default communicator processes.

Parameters
[in]root_rankrank from which to broadcast
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]valvalues to broadcast; input on root_rank, output on others (size: n)

◆ cs_parall_counter()

static void cs_parall_counter ( cs_gnum_t  cpt[],
const int  n 
)
inlinestatic

Sum values of a counter on all default communicator processes.

Parameters
[in,out]cptlocal counter in, global counter out (size: n)
[in]nnumber of values

◆ cs_parall_counter_max()

static void cs_parall_counter_max ( cs_lnum_t  cpt[],
const int  n 
)
inlinestatic

Maximum values of a counter on all default communicator processes.

Parameters
[in,out]cptlocal counter in, global counter out (size: n)
[in]nnumber of values

◆ cs_parall_gather_f()

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-precision arrays.

Local arrays are appended in order of owning MPI rank. The size of each local array may be different.

Use of this function may be quite practical, but should be limited to user functions, as it may limit scalability (especially as regards memory usage).

Parameters
[in]root_rankrank which stores the global array
[in]n_eltssize of the local array
[in]n_g_eltssize of the global array
[in]arraylocal array (size: n_elts)
[out]g_arrayglobal array (size: n_g_elts) only usable by the root rank

◆ cs_parall_gather_ordered_r()

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.

Local array elements are ordered based on a given key value (usually some form of coordinate, so the result should be independent of partitioning as long as the definition of the o_key array's defintion is itself independent of the partitioning.

Use of this function may be quite practical, but should be limited to user functions, as it may limit scalability (especially as regards memory usage).

Parameters
[in]root_rankrank which stores the global array
[in]n_eltsnumber of local elements
[in]n_g_eltsnumber of global elements
[in]stridenumber of values per element
[in]o_keyordering key (coordinate) value per element
[in]arraylocal array (size: n_elts*stride)
[out]g_arrayglobal array (size: n_g_elts*stride)

◆ cs_parall_gather_r()

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.

Local arrays are appended in order of owning MPI rank. The size of each local array may be different.

Use of this function may be quite practical, but should be limited to user functions, as it may limit scalability (especially as regards memory usage).

Parameters
[in]root_rankrank which stores the global array
[in]n_eltssize of the local array
[in]n_g_eltssize of the global array
[in]arraylocal array (size: n_elts)
[out]g_arrayglobal array (size: n_g_elts) only usable by the root rank

◆ cs_parall_get_min_coll_buf_size()

size_t cs_parall_get_min_coll_buf_size ( void  )

Return minimum recommended scatter or gather buffer size.

This is used by some internal part to block or scatter/gather algorithms, so as to allow I/O buffer size tuning.

Returns
minimum recommended part to block or gather buffer size (in bytes)

◆ cs_parall_max()

static void cs_parall_max ( int  n,
cs_datatype_t  datatype,
void *  val 
)
inlinestatic

Maximum values of a given datatype on all default communicator processes.

Parameters
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal value input, global value output (array)
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal maximum in, global maximum out (size: n)

◆ cs_parall_max_loc_vals()

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.

Parameters
[in]nsize of the related array
[in,out]maxlocal max in, global max out
[in,out]max_loc_valsarray values at location of local max in, and at location of global max out

◆ cs_parall_min()

static void cs_parall_min ( int  n,
cs_datatype_t  datatype,
void *  val 
)
inlinestatic

Minimum values of a given datatype on all default communicator processes.

Parameters
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal value input, global value output (array)
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal minimum in, global minimum out (size: n)

◆ cs_parall_min_id_rank_r()

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 value.

Parameters
[in,out]elt_idelement id for which the value is the smallest (local in, global out)
[in,out]rank_idrank id for which the value is the smallest (local in, global out)
[in]valassociated local minimum value

◆ cs_parall_min_loc_vals()

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.

Parameters
[in]nsize of the related array
[in,out]minxlocal max in, global max out
[in,out]min_loc_valsarray values at location of local max in, and at location of global max out
[in]nsize of the related array
[in,out]minlocal min in, global min out
[in,out]min_loc_valsarray values at location of local min in, and at location of global min out

◆ cs_parall_scatter_f()

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 to its local elements. Function dealing with single-precision arrays.

The size of each local array may be different.

Use of this function may be quite practical, but should be limited to specific usage, as it may limit scalability (especially as regards memory usage).

Parameters
[in]root_rankrank which stores the global array
[in]n_eltssize of the local array
[in]n_g_eltssize of the global array
[in]g_arrayglobal array (size: n_g_elts) only usable by the root rank
[out]arraylocal array (size: n_elts)

◆ cs_parall_scatter_r()

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 to its local elements.

The size of each local array may be different.

Use of this function may be quite practical, but should be limited to specific usage, as it may limit scalability (especially as regards memory usage).

Parameters
[in]root_rankrank which stores the global array
[in]n_eltssize of the local array
[in]n_g_eltssize of the global array
[in]g_arrayglobal array (size: n_g_elts) only usable by the root rank
[out]arraylocal array (size: n_elts)

◆ cs_parall_set_min_coll_buf_size()

void cs_parall_set_min_coll_buf_size ( size_t  buffer_size)

Define minimum recommended scatter or gather buffer size.

This is used by some internal part to block or scatter/gather algorithms, so as to allow I/O buffer size tuning.

Parameters
[in]buffer_sizeminimum recommended part to block or gather buffer size (in bytes)

◆ cs_parall_sum()

static void cs_parall_sum ( int  n,
cs_datatype_t  datatype,
void *  val 
)
inlinestatic

Sum values of a given datatype on all default communicator processes.

Parameters
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal value input, global value output (array)
[in]nnumber of values
[in]datatypematching code_saturne datatype
[in,out]vallocal sum in, global sum out (size: n)

◆ cs_parall_thread_range()

static void cs_parall_thread_range ( cs_lnum_t  n,
size_t  type_size,
cs_lnum_t s_id,
cs_lnum_t e_id 
)
inlinestatic

Compute array index bounds for a local thread. When called inside an OpenMP parallel section, this will return the start an past-the-end indexes for the array range assigned to that thread. In other cases, the start index is 1, and the past-the-end index is n;.

Parameters
[in]nsize of array
[in]type_sizeelement type size (or multiple)
[in,out]s_idstart index for the current thread
[in,out]e_idpast-the-end index for the current thread