Skip to content

Commit cbc3341

Browse files
add documentation for context methods
1 parent 7c9a426 commit cbc3341

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/Context_Methods.jl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,59 @@
11
import Printf.@printf
22

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+
"""
311
function GrB_init(mode::GrB_Mode)
412
return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_init"), Cint, (Cint, ), mode))
513
end
614

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+
"""
721
function GrB_wait()
822
return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_wait"), Cint, (), ))
923
end
1024

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+
"""
1131
function GrB_finalize()
1232
return GrB_Info(ccall(dlsym(graphblas_lib, "GrB_finalize"), Cint, (), ))
1333
end
1434

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+
"""
1557
function GrB_error()
1658
@printf("%s", unsafe_string(ccall(dlsym(graphblas_lib, "GrB_error"), Cstring, (), )))
1759
end

0 commit comments

Comments
 (0)