|
1 | 1 | import Printf.@printf
|
2 | 2 |
|
| 3 | +""" |
| 4 | + GrB_init(mode) |
| 5 | +
|
| 6 | +GrB_init must called before any other GraphBLAS operation. |
| 7 | +GrB_init defines the mode that GraphBLAS will use: blocking or non-blocking. |
| 8 | +With blocking mode, all operations finish before returning to the user application. |
| 9 | +With non-blocking mode, operations can be left pending, and are computed only when needed. |
| 10 | +""" |
3 | 11 | function GrB_init(mode::GrB_Mode)
|
4 | 12 | return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_init"), Cint, (Cint, ), mode))
|
5 | 13 | end
|
6 | 14 |
|
| 15 | +""" |
| 16 | + GrB_wait() |
| 17 | +
|
| 18 | +GrB_wait forces all pending operations to complete. |
| 19 | +Blocking mode is as if GrB_wait is called whenever a GraphBLAS method or operation returns to the user. |
| 20 | +""" |
7 | 21 | function GrB_wait()
|
8 | 22 | return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_wait"), Cint, (), ))
|
9 | 23 | end
|
10 | 24 |
|
| 25 | +""" |
| 26 | + GrB_finalize() |
| 27 | +
|
| 28 | +GrB_finalize must be called as the last GraphBLAS operation. |
| 29 | +GrB_finalize does not call GrB_wait; any pending computations are abandoned. |
| 30 | +""" |
11 | 31 | function GrB_finalize()
|
12 | 32 | return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_finalize"), Cint, (), ))
|
13 | 33 | end
|
14 | 34 |
|
| 35 | +""" |
| 36 | + GrB_error() |
| 37 | +
|
| 38 | +Each GraphBLAS method and operation returns a GrB_Info error code. |
| 39 | +GrB_error returns additional information on the error. |
| 40 | +
|
| 41 | +# Examples |
| 42 | +```jldoctest |
| 43 | +julia> using SuiteSparseGraphBLAS |
| 44 | +
|
| 45 | +julia> GrB_init(GrB_NONBLOCKING) |
| 46 | +GrB_SUCCESS::GrB_Info = 0 |
| 47 | +
|
| 48 | +julia> GrB_init(GrB_NONBLOCKING) |
| 49 | +GrB_INVALID_VALUE::GrB_Info = 5 |
| 50 | +
|
| 51 | +julia> GrB_error() |
| 52 | +GraphBLAS error: GrB_INVALID_VALUE |
| 53 | +function: GrB_init (mode) |
| 54 | +GrB_init must not be called twice |
| 55 | +``` |
| 56 | +""" |
15 | 57 | function GrB_error()
|
16 | 58 | @printf("%s", unsafe_string(ccall(dlsym(graphblas_lib, "GrB_error"), Cstring, (), )))
|
17 | 59 | end
|
0 commit comments