#include "cs_defs.h"#include "cs_base.h"#include "cs_base_accel.h"#include "cs_interface.h"#include "cs_rank_neighbors.h"#include "fvm_periodicity.h"Go to the source code of this file.
Data Structures | |
| struct | cs_halo_t |
Typedefs | |
| typedef struct _cs_halo_state_t | cs_halo_state_t |
Enumerations | |
| enum | cs_halo_type_t { CS_HALO_STANDARD , CS_HALO_EXTENDED , CS_HALO_N_TYPES } |
| enum | cs_halo_comm_mode_t { CS_HALO_COMM_P2P , CS_HALO_COMM_RMA_GET } |
Functions | |
| cs_halo_t * | cs_halo_create (const cs_interface_set_t *ifs) |
| Create a halo structure given an interface set. | |
| void | cs_halo_create_complete (cs_halo_t *halo) |
| Ready halo for use. | |
| cs_halo_t * | cs_halo_create_from_ref (const cs_halo_t *ref) |
| Create a halo structure, given a reference halo. | |
| cs_halo_t * | cs_halo_create_from_rank_neighbors (const cs_rank_neighbors_t *rn, cs_lnum_t n_local_elts, cs_lnum_t n_distant_elts, const int elt_rank_id[], const cs_lnum_t elt_id[]) |
| Create a halo structure from distant element distant ranks and ids. | |
| void | cs_halo_destroy (cs_halo_t **halo) |
| cs_halo_state_t * | cs_halo_state_create (void) |
| Create a halo state structure. | |
| void | cs_halo_state_destroy (cs_halo_state_t **halo_state) |
| Destroy a halo state structure. | |
| cs_halo_state_t * | cs_halo_state_get_default (void) |
| Get pointer to default halo state structure. | |
| static size_t | cs_halo_pack_size (const cs_halo_t *halo, cs_datatype_t data_type, int stride) |
| Compute required size for packing send data into dense buffer. | |
| void | cs_halo_renumber_cells (cs_halo_t *halo, const cs_lnum_t new_cell_id[]) |
| void | cs_halo_renumber_ghost_cells (cs_halo_t *halo, const cs_lnum_t old_cell_id[]) |
| void * | cs_halo_sync_pack_init_state (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_datatype_t data_type, int stride, void *send_buf, cs_halo_state_t *hs) |
| Initialize halo state prior to packing halo data to send. | |
| void | cs_halo_sync_pack (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_datatype_t data_type, int stride, void *val, void *send_buf, cs_halo_state_t *hs) |
| Pack halo data to send into dense buffer. | |
| void | cs_halo_sync_start (const cs_halo_t *halo, void *val, cs_halo_state_t *hs) |
| Launch update array of values in case of parallelism or periodicity. | |
| void | cs_halo_sync_wait (const cs_halo_t *halo, void *val, cs_halo_state_t *hs) |
| Wait for completion of update array of values in case of parallelism or periodicity. | |
| void | cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_datatype_t data_type, int stride, void *val) |
| Update array of values in case of parallelism or periodicity. | |
| void | cs_halo_sync_untyped (const cs_halo_t *halo, cs_halo_type_t sync_mode, size_t size, void *val) |
| void | cs_halo_sync_num (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_lnum_t num[]) |
| void | cs_halo_sync_var (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_real_t var[]) |
| void | cs_halo_sync_var_strided (const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_real_t var[], int stride) |
| bool | cs_halo_get_use_barrier (void) |
| void | cs_halo_set_use_barrier (bool use_barrier) |
| cs_halo_comm_mode_t | cs_halo_get_comm_mode (void) |
| Get default communication mode for halo exchange. | |
| void | cs_halo_set_comm_mode (cs_halo_comm_mode_t mode) |
| Set default communication mode for halo exchange. | |
| cs_alloc_mode_t | cs_halo_get_buffer_alloc_mode (void) |
| Get default host/device allocation mode for message packing arrays. | |
| void | cs_halo_set_buffer_alloc_mode (cs_alloc_mode_t mode) |
| Set default host/device allocation mode for message packing arrays. | |
| void | cs_halo_dump (const cs_halo_t *halo, int print_level) |
| typedef struct _cs_halo_state_t cs_halo_state_t |
Structure to maintain halo exchange state
| enum cs_halo_comm_mode_t |
| enum cs_halo_type_t |
| cs_halo_t * cs_halo_create | ( | const cs_interface_set_t * | ifs | ) |
Create a halo structure given an interface set.
| [in] | ifs | pointer to a cs_interface_set structure |
| void cs_halo_create_complete | ( | cs_halo_t * | halo | ) |
Ready halo for use.
This function should be called after building a halo using the cs_halo_create_function and defined locally. It is called automatically by cs_halo_create_from_ref and cs_halo_create_from_rank_neigbors so does not need to be called again using these functions.
| [in] | halo | pointer to halo structure |
This function should be called after building a halo using the cs_halo_create_function and defined locally. It is called automatically by cs_halo_create_from_ref and cs_halo_create_from_rank_neighbors so does not need to be called again using these functions.
| [in] | halo | pointer to halo structure |
| cs_halo_t * cs_halo_create_from_rank_neighbors | ( | const cs_rank_neighbors_t * | rn, |
| cs_lnum_t | n_local_elts, | ||
| cs_lnum_t | n_distant_elts, | ||
| const int | elt_rank_id[], | ||
| const cs_lnum_t | elt_id[] ) |
Create a halo structure from distant element distant ranks and ids.
| [in] | rn | associated rank neighbors info |
| [in] | n_local_elts | number of elements for local rank |
| [in] | n_distant_elts | number of distant elements for local rank |
| [in] | elt_rank_id | distant element rank index in rank neighbors, ordered by rank (size: n_distant_elts) |
| [in] | elt_id | distant element id (at distant rank), ordered by rank (size: n_distant_elts) |
Create a halo structure, given a reference halo.
| [in] | ref | pointer to reference halo |
| void cs_halo_destroy | ( | cs_halo_t ** | halo | ) |
brief Destroy a halo structure.
| [in,out] | halo | pointer to pointer to cs_halo structure to destroy. |
| void cs_halo_dump | ( | const cs_halo_t * | halo, |
| int | print_level ) |
| cs_alloc_mode_t cs_halo_get_buffer_alloc_mode | ( | void | ) |
Get default host/device allocation mode for message packing arrays.
| cs_halo_comm_mode_t cs_halo_get_comm_mode | ( | void | ) |
Get default communication mode for halo exchange.
| bool cs_halo_get_use_barrier | ( | void | ) |
|
inlinestatic |
Compute required size for packing send data into dense buffer.
| [in] | halo | pointer to halo structure |
| [in] | data_type | data type |
| [in] | stride | number of (interlaced) values by entity |
| void cs_halo_set_buffer_alloc_mode | ( | cs_alloc_mode_t | mode | ) |
Set default host/device allocation mode for message packing arrays.
| [in] | mode | allocation mode to set |
| void cs_halo_set_comm_mode | ( | cs_halo_comm_mode_t | mode | ) |
Set default communication mode for halo exchange.
| [in] | mode | allocation mode to set |
| void cs_halo_set_use_barrier | ( | bool | use_barrier | ) |
| cs_halo_state_t * cs_halo_state_create | ( | void | ) |
Create a halo state structure.
| void cs_halo_state_destroy | ( | cs_halo_state_t ** | halo_state | ) |
Destroy a halo state structure.
| [in,out] | halo_state | pointer to pointer to cs_halo_state structure to destroy. |
| cs_halo_state_t * cs_halo_state_get_default | ( | void | ) |
Get pointer to default halo state structure.
| void cs_halo_sync | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_datatype_t | data_type, | ||
| int | stride, | ||
| void * | val ) |
Update array of values in case of parallelism or periodicity.
This function aims at copying main values from local elements (id between 1 and n_local_elements) to ghost elements on distant ranks (id between n_local_elements + 1 to n_local_elements_with_halo).
| [in] | halo | pointer to halo structure |
| [in] | sync_mode | synchronization mode (standard or extended) |
| [in] | data_type | data type |
| [in] | stride | number of (interlaced) values by entity |
| [in] | val | pointer to variable value array |
| void cs_halo_sync_num | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_lnum_t | num[] ) |
| void cs_halo_sync_pack | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_datatype_t | data_type, | ||
| int | stride, | ||
| void * | val, | ||
| void * | send_buf, | ||
| cs_halo_state_t * | hs ) |
Pack halo data to send into dense buffer.
A local state handler may be provided, or the default state handler will be used.
A local state and/or buffer may be provided, or the default (global) state and buffer will be used. If provided explicitely, the buffer must be of sufficient size.
| [in] | halo | pointer to halo structure |
| [in] | sync_mode | synchronization mode (standard or extended) |
| [in] | data_type | data type |
| [in] | stride | number of (interlaced) values by entity |
| [in] | val | pointer to variable value array |
| [out] | send_buf | pointer to send buffer, nullptr for global buffer |
| [in,out] | hs | pointer to halo state, nullptr for global state |
| void * cs_halo_sync_pack_init_state | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_datatype_t | data_type, | ||
| int | stride, | ||
| void * | send_buf, | ||
| cs_halo_state_t * | hs ) |
Initialize halo state prior to packing halo data to send.
A local state handler may be provided, or the default state handler will be used.
This function is included in cs_halo_sync_pack, but may be called separately for specific implementations, such as for accelerator devices.
A local state and/or buffer may be provided, or the default (global) state and buffer will be used. If provided explicitely, the buffer must be of sufficient size.
| [in] | halo | pointer to halo structure |
| [in] | sync_mode | synchronization mode (standard or extended) |
| [in] | data_type | data type |
| [in] | stride | number of (interlaced) values by entity |
| [out] | send_buf | pointer to send buffer, nullptr for global buffer |
| [in,out] | hs | pointer to halo state, nullptr for global state |
| void cs_halo_sync_start | ( | const cs_halo_t * | halo, |
| void * | val, | ||
| cs_halo_state_t * | hs ) |
Launch update array of values in case of parallelism or periodicity.
This function aims at copying main values from local elements (id between 1 and n_local_elements) to ghost elements on distant ranks (id between n_local_elements + 1 to n_local_elements_with_halo).
The cs_halo_sync_pack function should have been called before this function, using the same hs argument.
| [in] | halo | pointer to halo structure |
| [in] | val | pointer to variable value array |
| [in,out] | hs | pointer to halo state, nullptr for global state |
| void cs_halo_sync_untyped | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| size_t | size, | ||
| void * | val ) |
| void cs_halo_sync_var | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_real_t | var[] ) |
| void cs_halo_sync_var_strided | ( | const cs_halo_t * | halo, |
| cs_halo_type_t | sync_mode, | ||
| cs_real_t | var[], | ||
| int | stride ) |
| void cs_halo_sync_wait | ( | const cs_halo_t * | halo, |
| void * | val, | ||
| cs_halo_state_t * | hs ) |
Wait for completion of update array of values in case of parallelism or periodicity.
This function aims at copying main values from local elements (id between 1 and n_local_elements) to ghost elements on distant ranks (id between n_local_elements + 1 to n_local_elements_with_halo).
The cs_halo_sync_start function should have been called before this function, using the same hs argument.
| [in] | halo | pointer to halo structure |
| [in] | val | pointer to variable value array |
| [in,out] | hs | pointer to halo state, nullptr for global state |