10 ms·
I don't use Gonum with a webserver + large calculations so I can't definitively answer. No one has reported problems, but that could be a lack of usage. One thi
by howeman 9y ago
I don't use Gonum with a webserver + large calculations so I can't definitively answer. No one has reported problems, but that could be a lack of usage. One thing though is that matrix multiplication (which is a kernel for higher-level operations) is written in a blocked format, and the code can be pre-empted on any of those blocks, so I wouldn't suspect it's a problem.
- openasocket 9y agoYeah, skimming your source it seems most of your loops involve calling some function, and even if that's inlined I believe the Go compiler will put a speculative yield call in there. I suppose my hypothetical would be an issue if you used a non-Go BLAS implementation, as calling out to C will hog the OS thread. But this is a known issue (e.x. https://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/ https://www.cockroachlabs.com/blog/the-cost-and-complexity-o...).
- chewxy 9y agoThe solution to that is to write a C-batcher. Gorgonia uses that (optional) - https://github.com/chewxy/gorgonia/tree/master/blase https://github.com/chewxy/gorgonia/tree/master/blase (also it's undergoing major reconstruction/refactoring right now)
- sbinet 9y agoalso, there's been work to make for-loops preemptible: - https://github.com/golang/go/issues/10958 https://github.com/golang/go/issues/10958 - https://go-review.googlesource.com/c/go/+/33910 https://go-review.googlesource.com/c/go/+/33910 - https://go-review.googlesource.com/c/go/+/36206 https://go-review.googlesource.com/c/go/+/36206 - https://go-review.googlesource.com/c/go/+/46410 https://go-review.googlesource.com/c/go/+/46410 - https://go-review.googlesource.com/c/go/+/43050 https://go-review.googlesource.com/c/go/+/43050