monolish  0.14.2
MONOlithic LIner equation Solvers for Highly-parallel architecture
Bcast.hpp
Go to the documentation of this file.
1 #include "../internal/monolish_internal.hpp"
2 #include "../internal/mpi/mpi_util.hpp"
3 
4 namespace monolish {
5 namespace {
6 // Scalar
7 template <typename T> void Bcast_core(T &val, int root, MPI_Comm comm) {
8  Logger &logger = Logger::get_instance();
9  logger.util_in(monolish_func);
10 
11 #if defined MONOLISH_USE_MPI
12  MPI_Bcast(&val, 1, internal::mpi::get_type(val), root, comm);
13 #endif
14 
15  logger.util_out();
16 }
17 
18 // std::vectror
19 template <typename T>
20 void Bcast_core(std::vector<T> &vec, int root, MPI_Comm comm) {
21  Logger &logger = Logger::get_instance();
22  logger.util_in(monolish_func);
23 
24 #if defined MONOLISH_USE_MPI
25  MPI_Bcast(vec.data(), vec.size(), internal::mpi::get_type(vec.data()[0]),
26  root, comm);
27 #endif
28 
29  logger.util_out();
30 }
31 
32 // monolish::vectror
33 template <typename T>
34 void Bcast_core(monolish::vector<T> &vec, int root, MPI_Comm comm) {
35  Logger &logger = Logger::get_instance();
36  logger.util_in(monolish_func);
37 
38 #if defined MONOLISH_USE_MPI
39  MPI_Bcast(vec.data(), vec.size(), internal::mpi::get_type(vec.data()[0]),
40  root, comm);
41 #endif
42 
43  logger.util_out();
44 }
45 
46 } // namespace
47 } // namespace monolish
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::vector::size
auto size() const
get vector size
Definition: monolish_vector.hpp:312
monolish::vector::data
const Float * data() const
returns a direct pointer to the vector
Definition: monolish_vector.hpp:236
monolish
Definition: monolish_matrix_blas.hpp:10
MPI_Comm
struct ompi_communicator_t * MPI_Comm
Definition: mpi_dummy.hpp:40
monolish::vector
vector class
Definition: monolish_coo.hpp:32
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42