fwd.h
Go to the documentation of this file.
1 #ifndef TTG_PARSEC_FWD_H
2 #define TTG_PARSEC_FWD_H
3 
4 #include "ttg/fwd.h"
5 #include "ttg/util/typelist.h"
6 #include "ttg/util/span.h"
7 
8 #include <future>
9 
10 #include <parsec.h>
11 
12 extern "C" struct parsec_context_s;
13 
14 namespace ttg_parsec {
15 
16  template <typename keyT, typename output_terminalsT, typename derivedT,
17  typename input_valueTs = ttg::typelist<>,
19  class TT;
20 
22  template <typename keyT, typename output_terminalsT, typename derivedT, typename... input_valueTs>
23  using Op [[deprecated("use TT instead")]] = TT<keyT, output_terminalsT, derivedT, ttg::typelist<input_valueTs...>>;
25  template <typename keyT, typename output_terminalsT, typename derivedT, typename... input_valueTs>
26  using TemplateTask = TT<keyT, output_terminalsT, derivedT, ttg::typelist<input_valueTs...>>;
27 
28  class WorldImpl;
29 
30  inline void make_executable_hook(ttg::World&);
31 
32  inline void ttg_initialize(int argc, char **argv, int num_threads = -1, parsec_context_s * = nullptr);
33 
34  inline void ttg_finalize();
35 
36  [[noreturn]]
37  static inline void ttg_abort();
38 
40 
41  inline void ttg_execute(ttg::World world);
42 
43  inline void ttg_fence(ttg::World world);
44 
45  template <typename T>
46  inline void ttg_register_ptr(ttg::World world, const std::shared_ptr<T> &ptr);
47 
48  inline void ttg_register_status(ttg::World world, const std::shared_ptr<std::promise<void>> &status_ptr);
49 
50  template <typename Callback>
51  inline void ttg_register_callback(ttg::World world, Callback &&callback);
52 
53  inline ttg::Edge<> &ttg_ctl_edge(ttg::World world);
54 
55  inline void ttg_sum(ttg::World world, double &value);
56 
59  template <typename T>
60  static void ttg_broadcast(ttg::World world, T &data, int source_rank);
61 
62  /* device definitions */
63  template<typename T, typename Allocator = std::allocator<std::decay_t<T>>>
64  struct Buffer;
65 
66  template<typename T>
67  struct Ptr;
68 
69  template<typename T>
70  struct devicescratch;
71 
72  template<typename T>
73  struct TTValue;
74 
75  template<typename T, typename... Args>
76  inline Ptr<T> make_ptr(Args&&... args);
77 
78  template<typename T>
79  inline Ptr<std::decay_t<T>> get_ptr(T&& obj);
80 
81  template<typename... Views>
82  bool register_device_memory(std::tuple<Views&...> &views);
83 
84  template<typename T, std::size_t N>
85  bool register_device_memory(const ttg::span<T, N>& span);
86 
87  template<typename... Buffer>
88  void post_device_out(std::tuple<Buffer&...> &b);
89 
90  template<typename... Buffer>
91  void mark_device_out(std::tuple<Buffer&...> &b);
92 
93  inline int num_devices();
94 
95  template<typename T>
96  parsec_data_t* buffer_data(T&& buffer);
97 
98 } // namespace ttg_parsec
99 
100 #endif // TTG_PARSEC_FWD_H
Edge is used to connect In and Out terminals.
Definition: edge.h:25
constexpr auto data(C &c) -> decltype(c.data())
Definition: span.h:189
int num_threads()
Determine the number of compute threads to use by TTG when not given to ttg::initialize
Definition: env.cpp:15
this contains PaRSEC-based TTG functionality
Definition: fwd.h:18
void ttg_fence(ttg::World world)
Definition: ttg.h:1119
void ttg_finalize()
Definition: ttg.h:1105
void ttg_register_ptr(ttg::World world, const std::shared_ptr< T > &ptr)
Definition: ttg.h:1122
Ptr< std::decay_t< T > > get_ptr(T &&obj)
Definition: ptr.h:252
int num_devices()
Definition: device.h:41
Ptr< T > make_ptr(Args &&... args)
Definition: ptr.h:270
void ttg_register_callback(ttg::World world, Callback &&callback)
Definition: ttg.h:1136
ttg::Edge & ttg_ctl_edge(ttg::World world)
Definition: ttg.h:1140
void make_executable_hook(ttg::World &)
Definition: ttg.h:1148
void post_device_out(std::tuple< Buffer &... > &b)
Definition: devicefunc.h:255
void ttg_initialize(int argc, char **argv, int num_threads=-1, parsec_context_s *=nullptr)
parsec_data_t * buffer_data(T &&buffer)
Definition: devicefunc.h:260
void ttg_register_status(ttg::World world, const std::shared_ptr< std::promise< void >> &status_ptr)
Definition: ttg.h:1131
ttg::World ttg_default_execution_context()
Definition: ttg.h:1115
void ttg_execute(ttg::World world)
Definition: ttg.h:1118
bool register_device_memory(std::tuple< Views &... > &views)
Definition: devicefunc.h:81
void mark_device_out(std::tuple< Buffer &... > &b)
Definition: devicefunc.h:218
void ttg_sum(ttg::World world, double &value)
Definition: ttg.h:1142
ExecutionSpace
denotes task execution space
Definition: execution.h:17
A container for types.
Definition: typelist.h:24