-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement multi-threading for covariance and gradient matrices (WIP) #129
base: master
Are you sure you want to change the base?
Conversation
I think there should be a threshold that decides whether to use Also, did you consider using tasks? |
Hi @Red-Portal, thank you for having a look into this. You're right to point out that there should be a threshold to determine whether to use threads if there is some overhead in doing so. I'll do some more benchmarks to check if it's necessary. The benchmarks above show that threads do make a big difference to performance. My understanding of tasks (coroutines) is that they solve a different problem: parallelising IO-bound tasks. Here multithreading is used to simultaneously compute multiple elements of the covariance matrix (and gradients). There is no communication or coordination between threads, so the overhead is low. |
Hi @maximerischard , The performance improvements are wonderful BTW. |
I've been reading a bit more about tasks and multithreading in julia. What I've done in this PR is use multithreading for the functions that iterate over the entries of an array. It's straightforwardly parallelisable, with no communication between threads, so low overhead. The overhead does seem to be non-zero, though when I benchmark it it's drowned in noise. Roughly speaking it seems to add 50ms to the benchmarks that take 1-2 seconds. You had two suggestions @Red-Portal:
|
a1513e1
to
033ea81
Compare
29b2854
to
2912010
Compare
2912010
to
651e6c4
Compare
651e6c4
to
93292d2
Compare
Pull Request Test Coverage Report for Build 568
💛 - Coveralls |
Pull Request Test Coverage Report for Build 625
💛 - Coveralls |
827298b
to
e1cc9e6
Compare
…efault value of EmptyData()
Single-threaded benchmark (
JULIA_NUM_THREADS=1
):Multi-threaded benchmark (
JULIA_NUM_THREADS=10
):I would be quite keen to get feedback from anyone who's worked with multi-threading in julia before.