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;
186 const bool verbosity =
false,
187#
if (defined(__GNUC__) || defined(__clang__)) && \
190 const char *file_name = __builtin_FILE(),
191 const int line_number = __builtin_LINE()
193 const char *file_name = __FILE__,
194 const int line_number = __LINE__
218 MPI_Comm_rank(this->_comm, &(this->_comm_rank));
219 MPI_Comm_size(this->_comm, &(this->_comm_n_ranks));
253#if defined(__CUDACC__)
254 cudaStream_t _stream;
256#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:210
int barrier(const bool verbosity=false, const char *file_name=__FILE__, const int line_number=__LINE__) const
Call MPI_Barrier over the MPI communicator, do nothing if no MPI.
Definition: cs_execution_context.cpp:74
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:231
#define __has_builtin(x)
Definition: cs_array_2dspan.h:48
static bool _initialized
Definition: cs_boundary_conditions_type.cpp:74
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
#define END_C_DECLS
Definition: cs_defs.h:555
void cs_execution_context_glob_finalize(void)
Free the global execution context pointer.
Definition: cs_execution_context.cpp:122
const cs_execution_context * cs_execution_context_glob_get(void)
Get the global execution context.
Definition: cs_execution_context.cpp:61
void cs_execution_context_glob_init(void)
Initialize the global execution context.
Definition: cs_execution_context.cpp:109
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:51