11 yakl_is_initialized =
false;
12 timer_init_func = [] () {
13 yakl_throw(
"ERROR: attempting to call the yakl::timer_init(); before calling yakl::init()");
15 timer_finalize_func = [] () {
16 yakl_throw(
"ERROR: attempting to call the yakl::timer_finalize(); before calling yakl::init()");
18 timer_start_func = [] (
char const *label) {
19 yakl_throw(
"ERROR: attempting to call the yakl::timer_start(); before calling yakl::init()");
21 timer_stop_func = [] (
char const * label) {
22 yakl_throw(
"ERROR: attempting to call the yakl::timer_stop(); before calling yakl::init()");
24 alloc_device_func = [] (
size_t bytes ,
char const *label ) ->
void* {
25 yakl_throw(
"ERROR: attempting memory alloc before calling yakl::init()");
28 free_device_func = [] (
void *ptr ,
char const *label ) {
29 yakl_throw(
"ERROR: attempting memory free before calling yakl::init()");
31 device_allocators_are_default =
false;
34 ~YAKL_Internal() =
default;
37 YAKL_Internal(
const YAKL_Internal&) =
delete;
38 YAKL_Internal& operator = (
const YAKL_Internal&) =
delete;
43 std::mutex yakl_final_mtx;
44 bool yakl_is_initialized;
45 std::function<void ()> timer_init_func;
46 std::function<void ()> timer_finalize_func;
47 std::function<void (
char const *)> timer_start_func;
48 std::function<void (
char const *)> timer_stop_func;
49 std::function<
void *( size_t ,
char const *)> alloc_device_func;
50 std::function<void (
void * ,
char const *)> free_device_func;
51 bool device_allocators_are_default;
53 std::vector< std::function<void ()> > finalize_callbacks;
55 static YAKL_Internal & get_instance() {
56 static YAKL_Internal instance;
63 inline YAKL_Internal & get_yakl_instance() {
return YAKL_Internal::get_instance(); }