fwd.h
Go to the documentation of this file.
1 #ifndef TTG_MADNESS_FWD_H
2 #define TTG_MADNESS_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 namespace ttg_madness {
11 
12  template <typename keyT, typename output_terminalsT, typename derivedT,
13  typename input_valueTs = ttg::typelist<>,
15  class TT;
16 
18  template <typename keyT, typename output_terminalsT, typename derivedT, typename... input_valueTs>
19  using Op [[deprecated("use TT instead")]] = TT<keyT, output_terminalsT, derivedT, ttg::typelist<input_valueTs...>>;
21  template <typename keyT, typename output_terminalsT, typename derivedT, typename... input_valueTs>
22  using TemplateTask = TT<keyT, output_terminalsT, derivedT, ttg::typelist<input_valueTs...>>;
23 
24  class WorldImpl;
25 
26  inline void make_executable_hook(ttg::World&);
27 
28  inline void ttg_initialize(int argc, char **argv, int num_threads = -1);
29 
30  inline void ttg_finalize();
31 
32  [[noreturn]]
33  inline void ttg_abort();
34 
36 
37  inline void ttg_execute(ttg::World world);
38 
39  inline void ttg_fence(ttg::World world);
40 
41  template <typename T>
42  inline void ttg_register_ptr(ttg::World world, const std::shared_ptr<T> &ptr);
43 
44  inline void ttg_register_status(ttg::World world, const std::shared_ptr<std::promise<void>> &status_ptr);
45 
46  inline ttg::Edge<> &ttg_ctl_edge(ttg::World world);
47 
48  template <typename T>
49  inline void ttg_sum(ttg::World world, T &value);
50 
51  template <typename T>
52  inline void ttg_broadcast(ttg::World world, T &data, int source_rank);
53 
54 
55  /* device definitions, not currently provided by this impl */
56  template<typename T, typename Allocator = std::allocator<T>>
57  struct Buffer;
58 
59  template<typename T>
60  struct Ptr;
61 
62  template<typename T>
63  struct devicescratch;
64 
65  template<typename T>
66  struct TTValue;
67 
68  template<typename T, typename... Args>
69  Ptr<T> make_ptr(Args&&... args);
70 
71  template<typename T>
72  auto get_ptr(T&& obj);
73 
74  template<typename... Views>
75  inline bool register_device_memory(std::tuple<Views&...> &views);
76 
77  template<typename T, std::size_t N>
78  inline bool register_device_memory(const ttg::span<T, N>& span);
79 
80  template<typename... Buffer>
81  inline void post_device_out(std::tuple<Buffer&...> &b);
82 
83  template<typename... Buffer>
84  inline void mark_device_out(std::tuple<Buffer&...> &b);
85 
86  inline int num_devices();
87 
88 } // namespace ttg_madness
89 
90 #endif // TTG_MADNESS_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 MADNESS-based TTG functionality
Definition: fwd.h:16
void ttg_register_ptr(ttg::World world, const std::shared_ptr< T > &ptr)
Definition: ttg.h:154
Ptr< T > make_ptr(Args &&... args)
void ttg_initialize(int argc, char **argv, int num_threads=-1)
Definition: ttg.h:130
int num_devices()
Definition: device.h:6
void ttg_execute(ttg::World world)
Definition: ttg.h:148
ttg::Edge & ttg_ctl_edge(ttg::World world)
Definition: ttg.h:172
auto get_ptr(T &&obj)
void ttg_sum(ttg::World world, T &value)
Definition: ttg.h:175
void ttg_fence(ttg::World world)
Definition: ttg.h:151
void ttg_finalize()
Definition: ttg.h:138
void make_executable_hook(ttg::World &)
Definition: ttg.h:128
void mark_device_out(std::tuple< Buffer &... > &b)
void ttg_broadcast(ttg::World world, T &data, int source_rank)
Definition: ttg.h:181
bool register_device_memory(std::tuple< Views &... > &views)
Definition: devicefunc.h:15
void ttg_abort()
Definition: ttg.h:144
void post_device_out(std::tuple< Buffer &... > &b)
void ttg_register_status(ttg::World world, const std::shared_ptr< std::promise< void >> &status_ptr)
Definition: ttg.h:163
ttg::World ttg_default_execution_context()
Definition: ttg.h:143
ExecutionSpace
denotes task execution space
Definition: execution.h:17
A container for types.
Definition: typelist.h:24
A runtime-managed buffer mirrored between host and device memory.
Definition: buffer.h:12