class runtime
Declaration
class runtime : private delegate, private delegate { /* full declaration omitted */ };
Inherits from: instruction_graph_generator::delegate, executor::delegate
Member Variables
- std::thread::id m_application_thread
- std::unique_ptr<config> m_cfg
- size_t m_num_nodes = 0
- node_id m_local_nid = 0
- size_t m_num_local_devices = 0
- bool m_has_live_queue = false
- std::unordered_set<buffer_id> m_live_buffers
- std::unordered_set<host_object_id> m_live_host_objects
- buffer_id m_next_buffer_id = 0
- raw_allocation_id m_next_user_allocation_id = 1
- host_object_id m_next_host_object_id = 0
- reduction_id m_next_reduction_id = no_reduction_id + 1
- std::unique_ptr<scheduler> m_schdlr
- std::unique_ptr<task_manager> m_task_mngr
- std::unique_ptr<executor> m_exec
- std::optional<task_id> m_latest_horizon_reached
- std::unique_ptr<detail::task_recorder> m_task_recorder
- std::unique_ptr<detail::command_recorder> m_command_recorder
- std::unique_ptr<detail::instruction_recorder> m_instruction_recorder
- static bool s_mpi_initialized = false
- static bool s_mpi_finalized = false
- static std::unique_ptr<runtime> s_instance
- static bool s_test_mode = false
- static bool s_test_active = false
- static bool s_test_runtime_was_instantiated = false
Member Function Overview
- create_buffer(const range<3> & range, size_t elem_size, size_t elem_align, allocation_id user_aid) → buffer_id
- create_host_object(std::unique_ptr<host_object_instance> instance) → host_object_id
- create_queue() → void
- create_reduction(std::unique_ptr<reducer> reducer) → reduction_id
- create_user_allocation(void * ptr) → allocation_id
- destroy_buffer(buffer_id bid) → void
- destroy_host_object(host_object_id hoid) → void
- destroy_queue() → void
- get_instance() → static runtime &
- get_task_manager() const → task_manager &
- has_instance() → static bool
- init(int * argc, char *** argv, const devices_or_selector & user_devices_or_selector = celerity::detail::auto_select_devices{}) → static void
- is_dry_run() const → bool
- operator=(runtime &&) → runtime &
- operator=(const runtime &) → runtime &
- runtime(runtime &&)
- runtime(const runtime &)
- set_buffer_debug_name(buffer_id bid, const std::string & debug_name) → void
- sync(detail::epoch_action action) → task_id
- test_case_enter() → static void
- test_case_exit() → static void
- test_mode_enter() → static void
- test_mode_exit() → static void
- test_require_mpi() → static void
- test_runtime_was_instantiated() → static bool
- ~runtime()
- destroy_instance_if_unreferenced() → static void
- epoch_reached(task_id epoch_tid) → void
- flush(std::vector<const instruction *> instructions, std::vector<outbound_pilot> pilot) → void
- horizon_reached(task_id horizon_tid) → void
- is_unreferenced() const → bool
- mpi_finalize_once() → static void
- mpi_initialize_once(int * argc, char *** argv) → static void
- require_call_from_application_thread() const → void
- runtime(int * argc, char *** argv, const devices_or_selector & user_devices_or_selector)
Member Functions
¶buffer_id create_buffer(const range<3>& range,
size_t elem_size,
size_t elem_align,
allocation_id user_aid)
buffer_id create_buffer(const range<3>& range,
size_t elem_size,
size_t elem_align,
allocation_id user_aid)
Parameters
- const range<3>& range
- size_t elem_size
- size_t elem_align
- allocation_id user_aid
¶host_object_id create_host_object(
std::unique_ptr<host_object_instance>
instance)
host_object_id create_host_object(
std::unique_ptr<host_object_instance>
instance)
Parameters
- std::unique_ptr<host_object_instance> instance
¶void create_queue()
void create_queue()
¶reduction_id create_reduction(
std::unique_ptr<reducer> reducer)
reduction_id create_reduction(
std::unique_ptr<reducer> reducer)
Parameters
- std::unique_ptr<reducer> reducer
¶allocation_id create_user_allocation(void* ptr)
allocation_id create_user_allocation(void* ptr)
Parameters
- void* ptr
¶void destroy_buffer(buffer_id bid)
void destroy_buffer(buffer_id bid)
Parameters
- buffer_id bid
¶void destroy_host_object(host_object_id hoid)
void destroy_host_object(host_object_id hoid)
Parameters
- host_object_id hoid
¶void destroy_queue()
void destroy_queue()
¶static runtime& get_instance()
static runtime& get_instance()
¶task_manager& get_task_manager() const
task_manager& get_task_manager() const
¶static bool has_instance()
static bool has_instance()
¶static void init(
int* argc,
char*** argv,
const devices_or_selector&
user_devices_or_selector = celerity::
detail::auto_select_devices{})
static void init(
int* argc,
char*** argv,
const devices_or_selector&
user_devices_or_selector = celerity::
detail::auto_select_devices{})
Parameters
- int* argc
- char*** argv
- const devices_or_selector& user_devices_or_selector = celerity::detail::auto_select_devices{}
¶bool is_dry_run() const
bool is_dry_run() const
¶runtime& operator=(runtime&&)
runtime& operator=(runtime&&)
Parameters
- runtime&&
¶runtime& operator=(const runtime&)
runtime& operator=(const runtime&)
Parameters
- const runtime&
¶runtime(runtime&&)
runtime(runtime&&)
Parameters
- runtime&&
¶runtime(const runtime&)
runtime(const runtime&)
Parameters
- const runtime&
¶void set_buffer_debug_name(
buffer_id bid,
const std::string& debug_name)
void set_buffer_debug_name(
buffer_id bid,
const std::string& debug_name)
Parameters
- buffer_id bid
- const std::string& debug_name
¶task_id sync(detail::epoch_action action)
task_id sync(detail::epoch_action action)
Parameters
- detail::epoch_action action
¶static void test_case_enter()
static void test_case_enter()
¶static void test_case_exit()
static void test_case_exit()
¶static void test_mode_enter()
static void test_mode_enter()
¶static void test_mode_exit()
static void test_mode_exit()
¶static void test_require_mpi()
static void test_require_mpi()
¶static bool test_runtime_was_instantiated()
static bool test_runtime_was_instantiated()
¶~runtime()
~runtime()
¶static void destroy_instance_if_unreferenced()
static void destroy_instance_if_unreferenced()
Description
Destroys the runtime if it is no longer active and all buffers and host objects have been unregistered.
¶void epoch_reached(task_id epoch_tid)
void epoch_reached(task_id epoch_tid)
Description
Called from the executor thread as soon as an epoch_instruction has finished executing.
Parameters
- task_id epoch_tid
¶void flush(
std::vector<const instruction*> instructions,
std::vector<outbound_pilot> pilot)
void flush(
std::vector<const instruction*> instructions,
std::vector<outbound_pilot> pilot)
Description
Called whenever new instructions have been generated and inserted into the instruction graph, and / or new pilot messages have been generated that must be transmitted to peer nodes before they can accept data transmitted through send_instruction
s originating from the local node. The vector of instructions is in topological order of dependencies, and so is the concatenation of all vectors that are passed through this function. Topological order here means that sequential execution in that order would fulfill all internal dependencies. The instruction graph generator guarantees that instruction pointers are stable and the pointed-to instructions are both immutable and safe to read from other threads. This is exposed as a single function on vectors to minimize lock contention in a threaded delegate implementations.
Parameters
- std::vector<const instruction*> instructions
- std::vector<outbound_pilot> pilot
¶void horizon_reached(task_id horizon_tid)
void horizon_reached(task_id horizon_tid)
Description
Called from the executor thread as soon as a horizon_instruction has finished executing.
Parameters
- task_id horizon_tid
¶bool is_unreferenced() const
bool is_unreferenced() const
Description
True when no buffers, host objects or queues are live that keep the runtime alive.
¶static void mpi_finalize_once()
static void mpi_finalize_once()
¶static void mpi_initialize_once(int* argc,
char*** argv)
static void mpi_initialize_once(int* argc,
char*** argv)
Parameters
- int* argc
- char*** argv
¶void require_call_from_application_thread() const
void require_call_from_application_thread() const
Description
Panic when not called from m_application_thread (see that variable for more info on the matter). Since there are thread-safe and non thread-safe member functions, we call this check at the beginning of all the non-safe ones.
¶runtime(int* argc,
char*** argv,
const devices_or_selector&
user_devices_or_selector)
runtime(int* argc,
char*** argv,
const devices_or_selector&
user_devices_or_selector)
Parameters
- int* argc
- char*** argv
- const devices_or_selector& user_devices_or_selector