9.0
general documentation
Loading...
Searching...
No Matches
cs_halo.cpp File Reference
#include "base/cs_defs.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "bft/bft_error.h"
#include "bft/bft_printf.h"
#include "base/cs_base.h"
#include "base/cs_base_accel.h"
#include "base/cs_interface.h"
#include "base/cs_mem.h"
#include "base/cs_order.h"
#include "base/cs_rank_neighbors.h"
#include "fvm/fvm_periodicity.h"
#include "base/cs_halo.h"
#include "base/cs_halo_perio.h"
Include dependency graph for cs_halo.cpp:

Functions

cs_halo_tcs_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_tcs_halo_create_from_ref (const cs_halo_t *ref)
 Create a halo structure, given a reference halo.
void cs_halo_destroy (cs_halo_t **halo)
cs_halo_state_tcs_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_tcs_halo_state_get_default (void)
 Get pointer to default halo state structure.
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)
template<typename T>
void cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, T val[])
 Update array of values in case of parallelism or periodicity.
template void cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[])
template<int Stride, typename T>
void cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, T val[][Stride])
template void cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[][3])
template void cs_halo_sync (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[][6])
template<typename T>
void cs_halo_sync (const cs_halo_t *halo, bool on_device, T val[])
template void cs_halo_sync (const cs_halo_t *halo, bool on_device, cs_real_t val[])
template<int Stride, typename T>
void cs_halo_sync (const cs_halo_t *halo, bool on_device, T val[][Stride])
template void cs_halo_sync (const cs_halo_t *halo, bool on_device, cs_real_t val[][3])
template void cs_halo_sync (const cs_halo_t *halo, bool on_device, cs_real_t val[][6])
template<typename T>
void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, T val[][3])
 Update ghost cell values of a spatial vector field, including rotational periodicity if present.
template void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[][3])
template<typename T>
void cs_halo_sync_r (const cs_halo_t *halo, bool on_device, T val[][3])
template void cs_halo_sync_r (const cs_halo_t *halo, bool on_device, cs_real_t val[][3])
template<typename T>
void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, T val[][6])
 Update ghost cell values of a symmetric tensor field, including rotational periodicity if present.
template void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[][6])
template<typename T>
void cs_halo_sync_r (const cs_halo_t *halo, bool on_device, T val[][6])
template void cs_halo_sync_r (const cs_halo_t *halo, bool on_device, cs_real_t val[][6])
template<typename T>
void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, T val[][3][3])
 Update ghost cell values of a non-symmetric tensor field, including rotational periodicity if present.
template void cs_halo_sync_r (const cs_halo_t *halo, cs_halo_type_t sync_mode, bool on_device, cs_real_t val[][3][3])

Function Documentation

◆ cs_halo_create()

cs_halo_t * cs_halo_create ( const cs_interface_set_t * ifs)

Create a halo structure given an interface set.

Parameters
[in]ifspointer to a cs_interface_set structure
Returns
pointer to created cs_halo_t structure

◆ cs_halo_create_complete()

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_neighbors so does not need to be called again using these functions.

Parameters
[in]halopointer to halo structure

◆ cs_halo_create_from_ref()

cs_halo_t * cs_halo_create_from_ref ( const cs_halo_t * ref)

Create a halo structure, given a reference halo.

Parameters
[in]refpointer to reference halo
Returns
pointer to created cs_halo_t structure

◆ cs_halo_destroy()

void cs_halo_destroy ( cs_halo_t ** halo)

brief Destroy a halo structure.

Parameters
[in,out]halopointer to pointer to cs_halo structure to destroy.

◆ cs_halo_dump()

void cs_halo_dump ( const cs_halo_t * halo,
int print_level )

◆ cs_halo_get_buffer_alloc_mode()

cs_alloc_mode_t cs_halo_get_buffer_alloc_mode ( void )

Get default host/device allocation mode for message packing arrays.

Returns
allocation mode

◆ cs_halo_get_comm_mode()

cs_halo_comm_mode_t cs_halo_get_comm_mode ( void )

Get default communication mode for halo exchange.

Returns
allocation mode

◆ cs_halo_get_use_barrier()

bool cs_halo_get_use_barrier ( void )

◆ cs_halo_renumber_cells()

void cs_halo_renumber_cells ( cs_halo_t * halo,
const cs_lnum_t new_cell_id[] )

◆ cs_halo_renumber_ghost_cells()

void cs_halo_renumber_ghost_cells ( cs_halo_t * halo,
const cs_lnum_t old_cell_id[] )

◆ cs_halo_set_buffer_alloc_mode()

void cs_halo_set_buffer_alloc_mode ( cs_alloc_mode_t mode)

Set default host/device allocation mode for message packing arrays.

Parameters
[in]modeallocation mode to set

◆ cs_halo_set_comm_mode()

void cs_halo_set_comm_mode ( cs_halo_comm_mode_t mode)

Set default communication mode for halo exchange.

Parameters
[in]modeallocation mode to set

◆ cs_halo_set_use_barrier()

void cs_halo_set_use_barrier ( bool use_barrier)

◆ cs_halo_state_create()

cs_halo_state_t * cs_halo_state_create ( void )

Create a halo state structure.

Returns
pointer to created cs_halo_state_t structure.

◆ cs_halo_state_destroy()

void cs_halo_state_destroy ( cs_halo_state_t ** halo_state)

Destroy a halo state structure.

Parameters
[in,out]halo_statepointer to pointer to cs_halo_state structure to destroy.

◆ cs_halo_state_get_default()

cs_halo_state_t * cs_halo_state_get_default ( void )

Get pointer to default halo state structure.

Returns
] halo pointer to pointer to cs_halo structure to destroy.

◆ cs_halo_sync() [1/11]

template void cs_halo_sync ( const cs_halo_t * halo,
bool on_device,
cs_real_t val[] )

◆ cs_halo_sync() [2/11]

template void cs_halo_sync ( const cs_halo_t * halo,
bool on_device,
cs_real_t val[][3] )

◆ cs_halo_sync() [3/11]

template void cs_halo_sync ( const cs_halo_t * halo,
bool on_device,
cs_real_t val[][6] )

◆ cs_halo_sync() [4/11]

template<typename T>
void cs_halo_sync ( const cs_halo_t * halo,
bool on_device,
T val[] )

◆ cs_halo_sync() [5/11]

template<int Stride, typename T>
void cs_halo_sync ( const cs_halo_t * halo,
bool on_device,
T val[][Stride] )

◆ cs_halo_sync() [6/11]

template void cs_halo_sync ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[] )

◆ cs_halo_sync() [7/11]

template void cs_halo_sync ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[][3] )

◆ cs_halo_sync() [8/11]

template void cs_halo_sync ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[][6] )

◆ cs_halo_sync() [9/11]

template<typename T>
void cs_halo_sync ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
T 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).

Template Parameters

in] T value type

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]on_devicerun on accelerated device if possible
[in,out]valpointer to variable value array

◆ cs_halo_sync() [10/11]

template<int Stride, typename T>
void cs_halo_sync ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
T val[][Stride] )

◆ cs_halo_sync() [11/11]

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

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]data_typedata type
[in]stridenumber of (interlaced) values by entity
[in]valpointer to variable value array

◆ cs_halo_sync_num()

void cs_halo_sync_num ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
cs_lnum_t num[] )

◆ cs_halo_sync_pack()

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.

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]data_typedata type
[in]stridenumber of (interlaced) values by entity
[in]valpointer to variable value array
[out]send_bufpointer to send buffer, null for global buffer
[in,out]hspointer to halo state, null for global state

◆ cs_halo_sync_pack_init_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.

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]data_typedata type
[in]stridenumber of (interlaced) values by entity
[out]send_bufpointer to send buffer, null for global buffer
[in,out]hspointer to halo state, null for global state
Returns
pointer to halo send buffer

◆ cs_halo_sync_r() [1/10]

template void cs_halo_sync_r ( const cs_halo_t * halo,
bool on_device,
cs_real_t val[][3] )

◆ cs_halo_sync_r() [2/10]

template void cs_halo_sync_r ( const cs_halo_t * halo,
bool on_device,
cs_real_t val[][6] )

◆ cs_halo_sync_r() [3/10]

template<typename T>
void cs_halo_sync_r ( const cs_halo_t * halo,
bool on_device,
T val[][3] )

◆ cs_halo_sync_r() [4/10]

template<typename T>
void cs_halo_sync_r ( const cs_halo_t * halo,
bool on_device,
T val[][6] )

◆ cs_halo_sync_r() [5/10]

template void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[][3] )

◆ cs_halo_sync_r() [6/10]

template void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[][3][3] )

◆ cs_halo_sync_r() [7/10]

template void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
cs_real_t val[][6] )

◆ cs_halo_sync_r() [8/10]

template<typename T>
void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
T val[][3] )

Update ghost cell values of a spatial vector field, including rotational periodicity if present.

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

Template Parameters

in] T value type

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]on_devicerun on accelerated device if possible
[in,out]valpointer to variable value array

◆ cs_halo_sync_r() [9/10]

template<typename T>
void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
T val[][3][3] )

Update ghost cell values of a non-symmetric tensor field, including rotational periodicity if present.

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

Template Parameters

in] T value type

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]on_devicerun on accelerated device if possible
[in,out]valpointer to variable value array

◆ cs_halo_sync_r() [10/10]

template<typename T>
void cs_halo_sync_r ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
bool on_device,
T val[][6] )

Update ghost cell values of a symmetric tensor field, including rotational periodicity if present.

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

Template Parameters

in] T value type

Parameters
[in]halopointer to halo structure
[in]sync_modesynchronization mode (standard or extended)
[in]on_devicerun on accelerated device if possible
[in,out]valpointer to variable value array

◆ cs_halo_sync_start()

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.

Parameters
[in]halopointer to halo structure
[in]valpointer to variable value array
[in,out]hspointer to halo state, null for global state

◆ cs_halo_sync_untyped()

void cs_halo_sync_untyped ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
size_t size,
void * val )

◆ cs_halo_sync_var()

void cs_halo_sync_var ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
cs_real_t var[] )

◆ cs_halo_sync_var_strided()

void cs_halo_sync_var_strided ( const cs_halo_t * halo,
cs_halo_type_t sync_mode,
cs_real_t var[],
int stride )

◆ cs_halo_sync_wait()

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.

Parameters
[in]halopointer to halo structure
[in]valpointer to variable value array
[in,out]hspointer to halo state, null for global state