8.3
general documentation
cs_execution_context Class Reference

#include <cs_execution_context.h>

+ Collaboration diagram for cs_execution_context:

Public Member Functions

 cs_execution_context ()
 Constructor. More...
 
virtual ~cs_execution_context ()
 Destructor. More...
 
int rank () const
 Getter function for MPI communicator rank id. More...
 
int n_ranks () const
 Getter function for MPI communicator number of ranks. More...
 
bool use_mpi () const
 Does the execution context uses MPI parallelism ? More...
 
bool is_mpi_root () const
 Is the current cpu/task the MPI root (rank 0) ? More...
 
int thread_id () const
 Getter function for thread id. More...
 
void comm_free ()
 Free the MPI communicator. More...
 
int barrier ()
 Call MPI_Barrier over the MPI communicator, do nothing if no MPI. More...
 
void set_comm (MPI_Comm comm)
 Set the execution context MPI communicator. More...
 
MPI_Comm comm () const
 Getter function for MPI communicator. More...
 

Detailed Description

Class used to define execution context for different methods and algorithms.

It handles both the distributed memory context (i.e. MPI communicator), and shared memory context (i.e. OpenMP thread, Cuda stream, SYCL queue).

Constructor & Destructor Documentation

◆ cs_execution_context()

Constructor.

◆ ~cs_execution_context()

virtual ~cs_execution_context ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ barrier()

int barrier ( )
inline

Call MPI_Barrier over the MPI communicator, do nothing if no MPI.

◆ comm()

MPI_Comm comm ( ) const
inline

Getter function for MPI communicator.

Returns
MPI communicator.

◆ comm_free()

void comm_free ( )
inline

Free the MPI communicator.

◆ is_mpi_root()

bool is_mpi_root ( ) const
inline

Is the current cpu/task the MPI root (rank 0) ?

Returns
true if caller is rank 0, false otherwise

◆ n_ranks()

int n_ranks ( ) const
inline

Getter function for MPI communicator number of ranks.

Returns
number of ranks inside the related MPI communicator.

◆ rank()

int rank ( ) const
inline

Getter function for MPI communicator rank id.

Returns
rank id inside the related MPI communicator.

◆ set_comm()

void set_comm ( MPI_Comm  comm)
inline

Set the execution context MPI communicator.

Parameters
[in]commMPI communicator to set

◆ thread_id()

int thread_id ( ) const
inline

Getter function for thread id.

Returns
thread id

◆ use_mpi()

bool use_mpi ( ) const
inline

Does the execution context uses MPI parallelism ?

Returns
true if MPI is used and n_ranks > 1, false otherwise

The documentation for this class was generated from the following file: