parsec_data.h
Go to the documentation of this file.
1 #ifndef TTG_PARSEC_PARSEC_DATA_H
2 #define TTG_PARSEC_PARSEC_DATA_H
3 
4 #include "ttg/parsec/buffer.h"
5 #include "ttg/buffer.h"
6 
7 namespace ttg_parsec::detail {
8  template<typename Value, typename Fn>
9  void foreach_parsec_data(Value&& value, Fn&& fn) {
10  /* protect for non-serializable types, allowed if the TT has no device op */
11  if constexpr (ttg::detail::has_buffer_apply_v<Value>) {
12  ttg::detail::buffer_apply(value, [&]<typename B>(B&& b){
13  parsec_data_t *data = detail::get_parsec_data(b);
14  if (nullptr != data) {
15  fn(data);
16  }
17  });
18  }
19  }
20 } // namespace ttg_parsec::detail
21 
22 #endif // TTG_PARSEC_PARSEC_DATA_H
constexpr auto data(C &c) -> decltype(c.data())
Definition: span.h:189
void buffer_apply(T &&t, Fn &&fn)
Definition: buffer.h:153
void foreach_parsec_data(Value &&value, Fn &&fn)
Definition: parsec_data.h:9
parsec_data_t * get_parsec_data(const ttg_parsec::Buffer< T, A > &db)
Definition: buffer.h:545
N.B. contains values of F_n and F_{n-1}.
Definition: fibonacci.cc:5