| 51 | #include "GB.h" |
| 52 | |
| 53 | GrB_Info GxB_init // start up GraphBLAS and also define malloc, etc |
| 54 | ( |
| 55 | GrB_Mode mode, // blocking or non-blocking mode, GPU or not |
| 56 | |
| 57 | // pointers to memory management functions |
| 58 | void * (* user_malloc_function ) (size_t), // required |
| 59 | void * (* user_calloc_function ) (size_t, size_t), // no longer used |
| 60 | void * (* user_realloc_function ) (void *, size_t), // optional, can be NULL |
| 61 | void (* user_free_function ) (void *) // required |
| 62 | ) |
| 63 | { |
| 64 | |
| 65 | //-------------------------------------------------------------------------- |
| 66 | // check inputs |
| 67 | //-------------------------------------------------------------------------- |
| 68 | |
| 69 | GB_CONTEXT ("GxB_init (mode, malloc, calloc, realloc, free)") ; |
| 70 | if (user_malloc_function == NULL || user_free_function == NULL) |
| 71 | { |
| 72 | // only malloc and free are required. calloc and/or realloc may be |
| 73 | // NULL |
| 74 | return (GrB_NULL_POINTER) ; |
| 75 | } |
| 76 | |
| 77 | //-------------------------------------------------------------------------- |
| 78 | // initialize GraphBLAS |
| 79 | //-------------------------------------------------------------------------- |
| 80 | |
| 81 | return (GB_init |
| 82 | (mode, // blocking or non-blocking mode |
| 83 | user_malloc_function, // user-defined malloc, required |
| 84 | user_realloc_function, // user-defined realloc, may be NULL |
| 85 | user_free_function, // user-defined free, required |
| 86 | Context)) ; |
| 87 | } |
| 88 | |