Commit d03f6f9
authored
342 execution issue with custom preconditioning function in conjugate gradient non blocking backend (#344)
This PCG algorithm allows for user-defined preconditioners to be supplied by the user. This functionality, in turn, was then used by the solver and KML_Solver transition paths to offer ready-made libraries for which users could supply their own preconditioners via function pointers. Those preconditioners would operate on standard raw C arrays, thus making use of the ALP native interface -- however, the PCG algorithm in ALP/GraphBLAS implicitly assumed the preconditioner action was implemented as an ALP function; i.e., not using the native interface.
This mismatch causes issues in combination with the nonblocking backend, which guarantees valid nonblocking execution for pure ALP programs, but in combination with native code requires calls to `grb::wait`.
This MR introduces a template argument to indicate whether the preconditioner may make use of native calls. This is done by extending the already-existing Boolean argument that previously indicated whether to apply preconditioning-- this is now become an `int` rather than `bool`, with `0` indicating no preconditioning, `1` indicating non-native (ALP-based) user-defined preconditioning, and `2` indicating possibly-native user-defined preconditioning. Only in the latter case does this MR furthermore activate the new calls to `grb::wait` that are necessary for native preconditioning functions.
An alternative design has that the authors of user-defined preconditioners should call `grb::wait` before taking and operating on native views of ALP/GraphBLAS vectors. In this design, the reported issue #342 would in fact indicate a bug in the related transition libraries. Comparing the implemented solution with this alternative design has that more care should be taken by those supplying user-defined preconditioners, and we instead prefer to make the life of any ALP user easier; hence the present solution was taken instead.
The bug that this MR fixes affected the PCG transition paths only; i.e., users of `solver.h` and/or `kml_iss.h`, only when using custom preconditioners, and only non-diagonal preconditioner actions.1 parent d5e9a06 commit d03f6f9
File tree
2 files changed
+21
-8
lines changed- include/graphblas/algorithms
- src/transition
2 files changed
+21
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
49 | 52 | | |
50 | | - | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
101 | | - | |
102 | | - | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
126 | | - | |
| 133 | + | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| |||
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
178 | | - | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| |||
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
347 | 357 | | |
348 | 358 | | |
349 | 359 | | |
| |||
443 | 453 | | |
444 | 454 | | |
445 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
446 | 459 | | |
447 | 460 | | |
448 | 461 | | |
| |||
572 | 585 | | |
573 | 586 | | |
574 | 587 | | |
575 | | - | |
| 588 | + | |
576 | 589 | | |
577 | 590 | | |
578 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
0 commit comments