19 static bool flag =
false;
23 static bool flag =
false;
54 template <
typename... RestOfArgs>
55 inline void initialize(
int argc,
char** argv,
int num_threads, RestOfArgs&&... args) {
58 throw std::runtime_error(
"ttg::initialize(): TTG already finalized, cannot be re-initialized");
62 if (
auto debugger_cstr = std::getenv(
"TTG_DEBUGGER")) {
64 auto debugger = std::make_shared<Debugger>();
66 debugger->set_exec(argv[0]);
67 debugger->set_cmd(debugger_cstr);
71 TTG_IMPL_NS::ttg_initialize(argc, argv, num_threads, std::forward<RestOfArgs>(args)...);
80 throw std::runtime_error(
"ttg::initialize(): TTG already initialized");
94 TTG_IMPL_NS::ttg_finalize();
99 throw std::runtime_error(
"ttg::finalize(): TTG has not been initialized yet");
104 inline void abort() { TTG_IMPL_NS::ttg_abort(); }
138 template <
typename TT>
151 template <
typename TT,
typename Key>
153 if (tt.keymap(key) == tt.get_world().rank()) {
154 tt.invoke(std::forward<Key>(key));
static void set_default_debugger(const std::shared_ptr< Debugger > &)
Set the global default debugger. The initial value is null.
static std::shared_ptr< Debugger > default_debugger()
Return the global default debugger.
ttg::World get_world() const override final
std::enable_if_t<!ttg::meta::is_void_v< Key > &&!ttg::meta::is_empty_tuple_v< input_values_tuple_type >, void > invoke(const Key &key, const input_values_tuple_type &args)
bool & initialized_accessor()
bool & finalized_accessor()
int num_threads()
Determine the number of compute threads to use by TTG when not given to ttg::initialize
top-level TTG namespace contains runtime-neutral functionality
void execute(ttg::World world)
Starts the execution in the given execution context.
void initialize(int argc, char **argv, int num_threads=-1, RestOfArgs &&...)
int size(World world=default_execution_context())
void abort()
Aborts the TTG program using the default backend's ttg_abort method.
World default_execution_context()
Accesses the default backend's default execution context.
void fence(ttg::World world)
Returns when all tasks associated with the given execution context have finished on all ranks.
void finalize()
Finalizes the TTG runtime.
int rank(World world=default_execution_context())