1 //------------------------------------------------------------------------------ 2 // GB_Global.h: definitions for global variables 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 // These defintions are not visible to the user. They are used only inside 11 // GraphBLAS itself. Note that the GB_Global struct does not appear here. 12 // It is accessible only by the functions in GB_Global.c. 13 14 #ifndef GB_GLOBAL_H 15 #define GB_GLOBAL_H 16 17 GB_PUBLIC void GB_Global_mode_set (GrB_Mode mode) ; 18 GrB_Mode GB_Global_mode_get (void) ; 19 20 void GB_Global_sort_set (int sort) ; 21 int GB_Global_sort_get (void) ; 22 23 GB_PUBLIC void GB_Global_GrB_init_called_set (bool GrB_init_called) ; 24 GB_PUBLIC bool GB_Global_GrB_init_called_get (void) ; 25 26 GB_PUBLIC void GB_Global_nthreads_max_set (int nthreads_max) ; 27 GB_PUBLIC int GB_Global_nthreads_max_get (void) ; 28 29 GB_PUBLIC int GB_Global_omp_get_max_threads (void) ; 30 31 GB_PUBLIC void GB_Global_chunk_set (double chunk) ; 32 GB_PUBLIC double GB_Global_chunk_get (void) ; 33 34 GB_PUBLIC void GB_Global_hyper_switch_set (float hyper_switch) ; 35 GB_PUBLIC float GB_Global_hyper_switch_get (void) ; 36 37 GB_PUBLIC void GB_Global_bitmap_switch_set (int k, float b) ; 38 GB_PUBLIC float GB_Global_bitmap_switch_get (int k) ; 39 GB_PUBLIC float GB_Global_bitmap_switch_matrix_get 40 (int64_t vlen, int64_t vdim) ; 41 GB_PUBLIC void GB_Global_bitmap_switch_default (void) ; 42 43 void GB_Global_is_csc_set (bool is_csc) ; 44 bool GB_Global_is_csc_get (void) ; 45 46 GB_PUBLIC void GB_Global_abort_function_set 47 (void (* abort_function) (void)) ; 48 GB_PUBLIC void GB_Global_abort_function (void) ; 49 50 void GB_Global_malloc_function_set 51 (void * (* malloc_function) (size_t)) ; 52 void * GB_Global_malloc_function (size_t size) ; 53 // calloc: no longer used 54 // void GB_Global_calloc_function_set 55 // (void * (* calloc_function) (size_t, size_t)) ; 56 // void * GB_Global_calloc_function (size_t count, size_t size) ; 57 void GB_Global_realloc_function_set 58 (void * (* realloc_function) (void *, size_t)) ; 59 void * GB_Global_realloc_function (void *p, size_t size) ; 60 bool GB_Global_have_realloc_function (void) ; 61 // bool GB_Global_have_calloc_function (void) ; 62 void GB_Global_free_function_set 63 (void (* free_function) (void *)) ; 64 void GB_Global_free_function (void *p) ; 65 66 GB_PUBLIC void GB_Global_malloc_is_thread_safe_set 67 (bool malloc_is_thread_safe) ; 68 GB_PUBLIC bool GB_Global_malloc_is_thread_safe_get (void) ; 69 70 GB_PUBLIC void GB_Global_malloc_tracking_set (bool malloc_tracking) ; 71 bool GB_Global_malloc_tracking_get (void) ; 72 73 void GB_Global_nmalloc_clear (void) ; 74 GB_PUBLIC int64_t GB_Global_nmalloc_get (void) ; 75 void GB_Global_nmalloc_increment (void) ; 76 GB_PUBLIC void GB_Global_nmalloc_decrement (void) ; 77 78 GB_PUBLIC void GB_Global_malloc_debug_set (bool malloc_debug) ; 79 GB_PUBLIC bool GB_Global_malloc_debug_get (void) ; 80 81 GB_PUBLIC void GB_Global_malloc_debug_count_set 82 (int64_t malloc_debug_count) ; 83 bool GB_Global_malloc_debug_count_decrement (void) ; 84 85 GB_PUBLIC void GB_Global_hack_set (int k, int64_t hack) ; 86 GB_PUBLIC int64_t GB_Global_hack_get (int k) ; 87 88 void GB_Global_burble_set (bool burble) ; 89 GB_PUBLIC bool GB_Global_burble_get (void) ; 90 91 GB_PUBLIC void GB_Global_print_one_based_set (bool onebased) ; 92 GB_PUBLIC bool GB_Global_print_one_based_get (void) ; 93 94 void GB_Global_gpu_control_set (GrB_Desc_Value value) ; 95 GrB_Desc_Value GB_Global_gpu_control_get (void); 96 void GB_Global_gpu_chunk_set (double gpu_chunk) ; 97 double GB_Global_gpu_chunk_get (void) ; 98 bool GB_Global_gpu_count_set (bool enable_cuda) ; 99 int GB_Global_gpu_count_get (void) ; 100 size_t GB_Global_gpu_memorysize_get (int device) ; 101 int GB_Global_gpu_sm_get (int device) ; 102 bool GB_Global_gpu_device_pool_size_set 103 (int device, size_t size) ; 104 bool GB_Global_gpu_device_max_pool_size_set 105 (int device, size_t size) ; 106 bool GB_Global_gpu_device_memory_resource_set 107 (int device, void *resource) ; 108 void* GB_Global_gpu_device_memory_resource_get 109 (int device) ; 110 bool GB_Global_gpu_device_properties_get (int device) ; 111 112 GB_PUBLIC void GB_Global_timing_clear_all (void) ; 113 GB_PUBLIC void GB_Global_timing_clear (int k) ; 114 GB_PUBLIC void GB_Global_timing_set (int k, double t) ; 115 GB_PUBLIC void GB_Global_timing_add (int k, double t) ; 116 GB_PUBLIC double GB_Global_timing_get (int k) ; 117 118 GB_PUBLIC int GB_Global_memtable_n (void) ; 119 GB_PUBLIC void GB_Global_memtable_dump (void) ; 120 GB_PUBLIC void GB_Global_memtable_clear (void) ; 121 GB_PUBLIC void GB_Global_memtable_add (void *p, size_t size) ; 122 GB_PUBLIC size_t GB_Global_memtable_size (void *p) ; 123 GB_PUBLIC void GB_Global_memtable_remove (void *p) ; 124 GB_PUBLIC bool GB_Global_memtable_find (void *p) ; 125 126 GB_PUBLIC void GB_Global_free_pool_init (bool clear) ; 127 GB_PUBLIC void *GB_Global_free_pool_get (int k) ; 128 GB_PUBLIC bool GB_Global_free_pool_put (void *p, int k) ; 129 GB_PUBLIC void GB_Global_free_pool_dump (int pr) ; 130 GB_PUBLIC int64_t GB_Global_free_pool_limit_get (int k) ; 131 GB_PUBLIC void GB_Global_free_pool_limit_set (int k, int64_t nblocks) ; 132 GB_PUBLIC int64_t GB_Global_free_pool_nblocks_total (void) ; 133 134 typedef int (* GB_flush_function_t) (void) ; 135 typedef int (* GB_printf_function_t) (const char *restrict format, ...) ; 136 137 GB_PUBLIC GB_printf_function_t GB_Global_printf_get (void) ; 138 GB_PUBLIC void GB_Global_printf_set (GB_printf_function_t p) ; 139 140 GB_PUBLIC GB_flush_function_t GB_Global_flush_get (void) ; 141 GB_PUBLIC void GB_Global_flush_set (GB_flush_function_t p) ; 142 143 #endif 144 145