19 #ifndef TIMPI_SERIAL_IMPLEMENTATION_H    20 #define TIMPI_SERIAL_IMPLEMENTATION_H    45 #define TIMPI_LOG_SCOPE(f,c)    53 #include <type_traits>    55 #ifndef TIMPI_HAVE_MPI    67                                 const MessageTag &)
 const    68 { timpi_not_implemented(); }
    74                                 const MessageTag &)
 const    75 { timpi_not_implemented(); }
    82 { timpi_not_implemented(); }
    90 { timpi_not_implemented(); }
    98 { timpi_not_implemented(); }
   100 template <
typename Context, 
typename Iter>
   107 { timpi_not_implemented(); }
   109 template <
typename Context, 
typename Iter>
   117 { timpi_not_implemented(); }
   119 template <
typename Context, 
typename Iter>
   125                                                          const MessageTag &)
 const   126 { timpi_not_implemented(); }
   128 template <
typename Context, 
typename OutputIter, 
typename T>
   135                                                             const MessageTag &)
 const   136 { timpi_not_implemented(); }
   141 template <
typename T>
   144                                      const MessageTag &)
 const   145 { timpi_not_implemented(); 
return Status(); }
   147 template <
typename T>
   151                                   const MessageTag &)
 const   152 { timpi_not_implemented(); }
   154 template <
typename T>
   159 { timpi_not_implemented(); 
return Status(); }
   161 template <
typename T>
   167 { timpi_not_implemented(); }
   169 template <
typename Context, 
typename OutputIter, 
typename T>
   176 { timpi_not_implemented(); }
   185 template <
typename T1, 
typename T2,
   186           typename std::enable_if<std::is_base_of<DataType, StandardType<T1>>::value &&
   187                                   std::is_base_of<DataType, StandardType<T2>>::value,
   191                                         const unsigned int timpi_dbg_var(recv_source),
   196   timpi_assert_equal_to (send_tgt, 0);
   197   timpi_assert_equal_to (recv_source, 0);
   201 template <
typename T1, 
typename T2, 
typename A1, 
typename A2>
   204                                 const std::vector<T1,A1> & send,
   206                                 const unsigned int timpi_dbg_var(source_processor_id),
   207                                 std::vector<T2,A2> &recv,
   212   timpi_assert_equal_to (dest_processor_id, 0);
   213   timpi_assert_equal_to (source_processor_id, 0);
   217 template <
typename T1, 
typename T2, 
typename A1, 
typename A2,
   218           typename std::enable_if<std::is_base_of<DataType, StandardType<T1>>::value &&
   219                                   std::is_base_of<DataType, StandardType<T2>>::value,
   223                                 const std::vector<T1,A1> & send,
   224                                 const unsigned int timpi_dbg_var(source_processor_id),
   225                                 std::vector<T2,A2> &recv,
   227                                 const MessageTag &)
 const   229   timpi_assert_equal_to (dest_processor_id, 0);
   230   timpi_assert_equal_to (source_processor_id, 0);
   234 template <
typename T, 
typename A,
   235           typename std::enable_if<std::is_base_of<DataType, StandardType<T>>::value,
   239                                 const std::vector<T,A> & send,
   240                                 const unsigned int timpi_dbg_var(source_processor_id),
   241                                 std::vector<T,A> &recv,
   245   timpi_assert_equal_to (dest_processor_id, 0);
   246   timpi_assert_equal_to (source_processor_id, 0);
   250 template <
typename T1, 
typename T2, 
typename A1, 
typename A2,
   251           typename std::enable_if<Has_buffer_type<Packing<T1>>::value &&
   255                                 const std::vector<T1,A1> & send,
   256                                 const unsigned int timpi_dbg_var(source_processor_id),
   257                                 std::vector<T2,A2> &recv,
   261   timpi_assert_equal_to (dest_processor_id, 0);
   262   timpi_assert_equal_to (source_processor_id, 0);
   266 template <
typename T, 
typename A,
   267           typename std::enable_if<Has_buffer_type<Packing<T>>::value, 
int>::type>
   270                                 const std::vector<T,A> & send,
   271                                 const unsigned int timpi_dbg_var(source_processor_id),
   272                                 std::vector<T,A> &recv,
   274                                 const MessageTag &)
 const   276   timpi_assert_equal_to (dest_processor_id, 0);
   277   timpi_assert_equal_to (source_processor_id, 0);
   281 template <
typename T1, 
typename T2, 
typename A1, 
typename A2, 
typename A3, 
typename A4>
   284                                 const std::vector<std::vector<T1,A1>,A2> & send,
   285                                 const unsigned int timpi_dbg_var(source_processor_id),
   286                                 std::vector<std::vector<T2,A3>,A4> &recv,
   288                                 const MessageTag &)
 const   290   timpi_assert_equal_to (dest_processor_id, 0);
   291   timpi_assert_equal_to (source_processor_id, 0);
   295 template <
typename T, 
typename A1, 
typename A2>
   298                                 const std::vector<std::vector<T,A1>,A2> & send,
   299                                 const unsigned int timpi_dbg_var(source_processor_id),
   300                                 std::vector<std::vector<T,A1>,A2> &recv,
   304   timpi_assert_equal_to (dest_processor_id, 0);
   305   timpi_assert_equal_to (source_processor_id, 0);
   318 template <
typename Context1, 
typename RangeIter,
   319           typename Context2, 
typename OutputIter, 
typename T>
   322   (
const unsigned int timpi_dbg_var(dest_processor_id),
   323    const Context1 * context1,
   324    RangeIter send_begin,
   325    const RangeIter send_end,
   326    const unsigned int timpi_dbg_var(source_processor_id),
   329    const T * output_type,
   336   timpi_assert_equal_to(dest_processor_id, 0);
   337   timpi_assert_equal_to(source_processor_id, 0);
   341   typedef typename std::iterator_traits<RangeIter>::value_type T1;
   346   std::unique_ptr<OutputIter> next_out_iter =
   347     std::make_unique<OutputIter>(out_iter);
   349   while (send_begin != send_end)
   351       timpi_assert_greater (std::distance(send_begin, send_end), 0);
   355       std::vector<buffer_t> buffer;
   358         (context1, send_begin, send_end, buffer);
   360       timpi_assert_greater (std::distance(send_begin, next_send_begin), 0);
   362       send_begin = next_send_begin;
   365         (buffer, context2, *next_out_iter, output_type);
   366       next_out_iter = std::make_unique<OutputIter>(return_out_iter);
   372 template <
typename T, 
typename A,
   373           typename std::enable_if<std::is_base_of<DataType, StandardType<T>>::value, 
int>::type>
   381   timpi_not_implemented();
   384 template <
typename T, 
typename A,
   385           typename std::enable_if<Has_buffer_type<Packing<T>>::value, 
int>::type>
   388                                             const NotADataType &,
   390                                             const MessageTag &)
 const   393   timpi_not_implemented();
   396 template <
typename T, 
typename A1, 
typename A2>
   399                                      std::vector<std::vector<T,A1>,A2> &,
   402                                      const MessageTag &)
 const   405   timpi_not_implemented();
   408 template <
typename T, 
typename A>
   410                                     std::vector<std::basic_string<T>,A> & recv,
   413   timpi_assert(this->
size() == 1);
   421 #endif // ifndef TIMPI_HAVE_MPI   423 #endif // TIMPI_SERIAL_IMPLEMENTATION_H void allgather(const T &send_data, std::vector< T, A > &recv_data) const
Take a vector of length this->size(), and fill in recv[processor_id] = the value of send on that proc...
void nonblocking_send_packed_range(const unsigned int dest_processor_id, const Context *context, Iter range_begin, const Iter range_end, Request &req, const MessageTag &tag=no_tag) const
Similar to the above Nonblocking send_packed_range with a few important differences: ...
OutputIter unpack_range(const std::vector< buffertype > &buffer, Context *context, OutputIter out_iter, const T *)
Helper function for range unpacking. 
Encapsulates the MPI_Datatype. 
Define data types and (un)serialization functions for use when encoding a potentially-variable-size o...
void send_packed_range(const unsigned int dest_processor_id, const Context *context, Iter range_begin, const Iter range_end, const MessageTag &tag=no_tag, std::size_t approx_buffer_size=1000000) const
Blocking-send range-of-pointers to one processor. 
void nonblocking_receive_packed_range(const unsigned int src_processor_id, Context *context, OutputIter out, const T *output_type, Request &req, Status &stat, const MessageTag &tag=any_tag) const
Non-Blocking-receive range-of-pointers from one processor. 
bool possibly_receive(unsigned int &src_processor_id, std::vector< T, A > &buf, Request &req, const MessageTag &tag) const
Nonblocking-receive from one processor with user-defined type. 
processor_id_type size() const
Status receive(const unsigned int dest_processor_id, T &buf, const MessageTag &tag=any_tag) const
Blocking-receive from one processor with data-defined type. 
Encapsulates the MPI tag integers. 
void receive_packed_range(const unsigned int dest_processor_id, Context *context, OutputIter out, const T *output_type, const MessageTag &tag=any_tag) const
Blocking-receive range-of-pointers from one processor. 
Iter pack_range(const Context *context, Iter range_begin, const Iter range_end, std::vector< buffertype > &buffer, std::size_t approx_buffer_size)
Helper function for range packing. 
void send_receive(const unsigned int dest_processor_id, const T1 &send_data, const unsigned int source_processor_id, T2 &recv_data, const MessageTag &send_tag=no_tag, const MessageTag &recv_tag=any_tag) const
Send data send to one processor while simultaneously receiving other data recv from a (potentially di...
StandardType<T>'s which do not define a way to MPI_Type T should inherit from this class...
Encapsulates the MPI_Request. 
void send(const unsigned int dest_processor_id, const T &buf, const MessageTag &tag=no_tag) const
Blocking-send to one processor with data-defined type. 
void send_receive_packed_range(const unsigned int dest_processor_id, const Context1 *context1, RangeIter send_begin, const RangeIter send_end, const unsigned int source_processor_id, Context2 *context2, OutputIter out, const T *output_type, const MessageTag &send_tag=no_tag, const MessageTag &recv_tag=any_tag, std::size_t approx_buffer_size=1000000) const
Send a range-of-pointers to one processor while simultaneously receiving another range from a (potent...
Encapsulates the MPI_Status struct.