Skip to content
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

More performance improvement to log density evaluation #230

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

sunxd3
Copy link
Member

@sunxd3 sunxd3 commented Oct 27, 2024

This remove another performance bottleneck: getindex from MetaGraph. This is done by storing the data in arrays.

The size of a BUGSModel is increased by 15%.

And it roughly half the previous time, while not impacting the ReverseDiff time.

sunxd3 and others added 2 commits October 27, 2024 14:50
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coveralls
Copy link

coveralls commented Oct 27, 2024

Pull Request Test Coverage Report for Build 11541635140

Details

  • 50 of 51 (98.04%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 78.246%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/model.jl 46 47 97.87%
Totals Coverage Status
Change from base Build 11519174461: 0.4%
Covered Lines: 1410
Relevant Lines: 1802

💛 - Coveralls

Copy link
Contributor

github-actions bot commented Oct 27, 2024

BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.5.0 to /home/runner/.bridgestan/bridgestan-2.5.0
Done!
Model dogs produces error: ErrorException("log_density() failed with exception: Exception: bernoulli_lpmf: Probability parameter is inf, but must be in the interval [0, 1] (in '/home/runner/work/JuliaBUGS.jl/JuliaBUGS.jl/benchmark/stan/bugs_examples/vol1/dogs/dogs.stan', line 37, column 6 to line 38, column 62)\n")

Model Parameter Count Data Count Stan Density Time (µs) Stan Density Gradient Time (µs) JuliaBUGS Density Time with Graph Walk (µs) JuliaBUGS Density Gradient Time with ReverseDiff.jl(compiled tape) (µs)
rats 65 150 5.5624 8.07167 138.207 85.5195
pumps 12 10 0.978833 1.28504 18.825 6.34925
dogs 2 720 NA NA 265.154 150.305
seeds 26 21 2.51291 3.12922 49.1165 21.53
surgical_realistic 14 12 1.26496 1.61911 24.715 8.506
magnesium 108 96 10.3645 11.9825 237.342 73.848
salm 22 18 2.37017 3.10306 39.283 12.383
equiv 15 20 2.50373 3.39375 27.351 17.984
dyes 9 30 1.02618 1.33386 16.716 12.964
stacks 6 21 1.12596 1.68841 52.619 14.647
epil 303 236 32.821 38.231 603.015 239.336
blockers 47 44 3.28944 3.73063 107.992 28.283
oxford 244 240 16.13 18.726 704.884 173.784
lsat 1006 5000 173.574 214.736 4083.15 1187.36
bones 33 422 73.758 91.48 1356.48 190.204
mice 20 65 7.32375 9.451 42.279 37.48
kidney 64 58 10.765 16.261 121.757 76.332
leuk 18 714 20.428 26.9 336.116 205.393
leukfr 40 714 23.804 31.949 371.893 239.897

@sunxd3 sunxd3 changed the title Mote performance improvement to log density evaluation More performance improvement to log density evaluation Oct 27, 2024
@sunxd3
Copy link
Member Author

sunxd3 commented Oct 29, 2024

This is not perfect, but I am merging this now and will optimize memory size later.

@sunxd3 sunxd3 merged commit b466e8e into master Oct 29, 2024
13 checks passed
@sunxd3 sunxd3 deleted the sunxd/further_improve_performance branch October 29, 2024 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants