DCEGM.jl
DCEGM.jl copied to clipboard
added @threads benchmark, addresses issue #21
- tested that solution is the same
- performance seems very variable and I haven't understood properly why
- it seems threading works best with not too many shared recources (i.e. narrow parts of the codebase, like some inner loop)
- it also seemed that 2 threads for 2 discrete choices makes sense.
- more threads are not beneficial at all (laptop only has 2 physical cores...)
GModel thread at future states iy
using 1 threads
===========================
fedors model on na=5000,ny=50
10.349 s (2541454 allocations: 6.14 GiB)
general model on na=500,ny=15
2.698 s (3575181 allocations: 2.86 GiB)
using 2 threads
===========================
fedors model on na=5000,ny=50
9.139 s (2541712 allocations: 6.14 GiB)
general model on na=500,ny=15
2.324 s (3579355 allocations: 2.86 GiB)
using 3 threads
===========================
fedors model on na=5000,ny=50
8.577 s (2541953 allocations: 6.14 GiB)
general model on na=500,ny=15
2.541 s (3583345 allocations: 2.86 GiB)
using 4 threads
===========================
fedors model on na=5000,ny=50
10.428 s (2542184 allocations: 6.14 GiB)
general model on na=500,ny=15
2.802 s (3586972 allocations: 2.86 GiB)
GModel thread at future dchoices
using 1 threads
===========================
fedors model on na=5000,ny=50
12.048 s (2541454 allocations: 6.14 GiB)
general model on na=500,ny=15
2.881 s (3691821 allocations: 3.03 GiB)
using 2 threads
===========================
fedors model on na=5000,ny=50
8.127 s (2541723 allocations: 6.14 GiB)
general model on na=500,ny=15
2.567 s (3746074 allocations: 3.04 GiB)
using 3 threads
===========================
fedors model on na=5000,ny=50
8.070 s (2541955 allocations: 6.14 GiB)
general model on na=500,ny=15
3.068 s (3801400 allocations: 3.05 GiB)
using 4 threads
===========================
fedors model on na=5000,ny=50
8.006 s (2542194 allocations: 6.14 GiB)
general model on na=500,ny=15
4.130 s (3854577 allocations: 3.05 GiB)
using 4 threads
===========================
fedors model on na=5000,ny=50
8.022 s (2542189 allocations: 6.14 GiB)
general model on na=500,ny=15
3.253 s (3854386 allocations: 3.05 GiB)