MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / RG_Matrix_sync

Function RG_Matrix_sync

src/graph/rg_matrix/rg_wait.c:71–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71static void RG_Matrix_sync
72(
73 RG_Matrix C,
74 bool force_sync,
75 uint64_t delta_max_pending_changes
76) {
77 ASSERT(C != NULL);
78
79 GrB_Matrix m = RG_MATRIX_M(C);
80 GrB_Matrix dp = RG_MATRIX_DELTA_PLUS(C);
81 GrB_Matrix dm = RG_MATRIX_DELTA_MINUS(C);
82
83 if(force_sync) {
84 RG_Matrix_sync_deletions(C);
85 RG_Matrix_sync_additions(C);
86 } else {
87 GrB_Index dp_nvals;
88 GrB_Index dm_nvals;
89
90 //----------------------------------------------------------------------
91 // determin change set
92 //----------------------------------------------------------------------
93
94 GrB_Matrix_nvals(&dp_nvals, dp);
95 GrB_Matrix_nvals(&dm_nvals, dm);
96
97 //----------------------------------------------------------------------
98 // perform deletions
99 //----------------------------------------------------------------------
100
101 if(dm_nvals >= delta_max_pending_changes) {
102 RG_Matrix_sync_deletions(C);
103 }
104
105 //----------------------------------------------------------------------
106 // perform additions
107 //----------------------------------------------------------------------
108
109 if(dp_nvals >= delta_max_pending_changes) {
110 RG_Matrix_sync_additions(C);
111 }
112 }
113
114 // wait on all 3 matrices
115 GrB_Info info = GrB_wait(m, GrB_MATERIALIZE);
116 ASSERT(info == GrB_SUCCESS);
117
118 info = GrB_wait(dm, GrB_MATERIALIZE);
119 ASSERT(info == GrB_SUCCESS);
120
121 info = GrB_wait(dp, GrB_MATERIALIZE);
122 ASSERT(info == GrB_SUCCESS);
123}
124
125GrB_Info RG_Matrix_wait
126(

Callers 1

RG_Matrix_waitFunction · 0.85

Calls 3

RG_Matrix_sync_deletionsFunction · 0.85
RG_Matrix_sync_additionsFunction · 0.85
GrB_Matrix_nvalsFunction · 0.85

Tested by

no test coverage detected