bankofcanada / ModelBaseEcon.jl

BSD 3-Clause "New" or "Revised" License
26 stars 5 forks source link

proof of concept, multithread `eval_RJ` #50

Closed KristofferC closed 11 months ago

KristofferC commented 1 year ago

The evaluations of the residuals and Jacobians seem independent and it should therefore be possible to evaluate them in parallel. A simple use of the Threads.@threads loop construct gives:

baseline:

julia> @btime eval_RJ(pt, m);
  399.917 μs (6695 allocations: 262.45 KiB)

PR with --threads=8 on an Mac M1 Pro:

julia> @btime eval_RJ(pt, m);
  106.875 μs (6743 allocations: 267.98 KiB)
codecov-commenter commented 1 year ago

Codecov Report

Merging #50 (3e71ab0) into master (7a7dfa8) will decrease coverage by 1.48%. The diff coverage is 69.60%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
- Coverage   94.43%   92.95%   -1.48%     
==========================================
  Files          15       16       +1     
  Lines        1671     1746      +75     
==========================================
+ Hits         1578     1623      +45     
- Misses         93      123      +30     
Impacted Files Coverage Δ
src/ModelBaseEcon.jl 100.00% <ø> (ø)
src/metafuncs.jl 100.00% <ø> (ø)
src/precompile.jl 0.00% <0.00%> (ø)
src/evaluation.jl 81.38% <88.09%> (-0.81%) :arrow_down:
src/equation.jl 94.73% <100.00%> (ø)
src/model.jl 96.80% <100.00%> (+0.17%) :arrow_up:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.