1#ifndef __CS_EXECUTION_CONTEXT_H__
2#define __CS_EXECUTION_CONTEXT_H__
44#if defined(SYCL_LANGUAGE_VERSION)
45#include <sycl/sycl.hpp>
77 this->_comm = MPI_COMM_NULL;
80 this->_comm_n_ranks = 0;
117 return _comm_n_ranks;
130 bool retval = (_comm_n_ranks > 1) ?
true :
false;
144 bool retval = (_comm_rank < 1) ?
true :
false;
171 if (_comm != MPI_COMM_NULL)
172 MPI_Comm_free(&(this->_comm));
173 this->_comm = MPI_COMM_NULL;
188 if (_comm != MPI_COMM_NULL)
189 retval = MPI_Barrier(_comm);
214 MPI_Comm_rank(this->_comm, &(this->_comm_rank));
215 MPI_Comm_size(this->_comm, &(this->_comm_n_ranks));
250 cudaStream_t _stream;
252#elif defined(SYCL_LANGUAGE_VERSION)
Definition: cs_execution_context.h:61
int rank() const
Getter function for MPI communicator rank id.
Definition: cs_execution_context.h:102
void comm_free()
Free the MPI communicator.
Definition: cs_execution_context.h:168
void set_comm(MPI_Comm comm)
Set the execution context MPI communicator.
Definition: cs_execution_context.h:206
int barrier()
Call MPI_Barrier over the MPI communicator, do nothing if no MPI.
Definition: cs_execution_context.h:184
bool is_mpi_root() const
Is the current cpu/task the MPI root (rank 0) ?
Definition: cs_execution_context.h:142
cs_execution_context()
Constructor.
Definition: cs_execution_context.h:74
bool use_mpi() const
Does the execution context uses MPI parallelism ?
Definition: cs_execution_context.h:128
virtual ~cs_execution_context()
Destructor.
Definition: cs_execution_context.h:90
int thread_id() const
Getter function for thread id.
Definition: cs_execution_context.h:156
int n_ranks() const
Getter function for MPI communicator number of ranks.
Definition: cs_execution_context.h:115
MPI_Comm comm() const
Getter function for MPI communicator.
Definition: cs_execution_context.h:227
static bool _initialized
Definition: cs_boundary_conditions_type.cpp:74
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
void cs_execution_context_glob_finalize(void)
Free the global execution context pointer.
Definition: cs_execution_context.cpp:87
const cs_execution_context * cs_execution_context_glob_get(void)
Get the global execution context.
Definition: cs_execution_context.cpp:60
void cs_execution_context_glob_init(void)
Initialize the global execution context.
Definition: cs_execution_context.cpp:74
const cs_execution_context * cs_execution_context_get(void)
Get the current execution context. For the moment only global context is returned.
Definition: cs_execution_context.cpp:50