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

Improve Collectvariables again #144

Merged
merged 7 commits into from
Feb 29, 2024
Merged

Conversation

sunxd3
Copy link
Member

@sunxd3 sunxd3 commented Feb 28, 2024

Streamline the checks:

  • The checking for number of dimensions mismatches is moved to a function called extract_variable_names_and_numdims. This function go through the whole model definition and collect all the variables and their ndims.
  • introduced a new function called simplify_lhs, which calls a evaluate function called simple_arithmetic_eval. simple_arithmetic_eval is more restrictive and should only used to evaluate expression in indices and loop bounds.
  • use Base.checkbounds to perform in bound checking for data arrays
  • introduced new functions to check if the lhs of a deterministic assignment is specified as data

Also used StaticArrays.MVector for array sizes, instead of collecting all possible LHS and do post-processing. This gives better memory performance. On Leuk, the memory use is reduced from ~6MB to ~3MB, mostly should be attributed to this.

Combined, the time is reduce by 1-2 ms.

src/JuliaBUGS.jl Outdated Show resolved Hide resolved
src/compiler_pass.jl Outdated Show resolved Hide resolved
src/compiler_pass.jl Outdated Show resolved Hide resolved
src/compiler_pass.jl Outdated Show resolved Hide resolved
test/bugs_primitives.jl Outdated Show resolved Hide resolved
sunxd3 and others added 2 commits February 28, 2024 10:33
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

Pull Request Test Coverage Report for Build 8078906539

Details

  • -35 of 199 (82.41%) changed or added relevant lines in 3 files are covered.
  • 30 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.3%) to 79.939%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/utils.jl 97 112 86.61%
src/compiler_pass.jl 65 85 76.47%
Files with Coverage Reduction New Missed Lines %
src/utils.jl 14 82.14%
src/compiler_pass.jl 16 90.8%
Totals Coverage Status
Change from base Build 8067597301: -0.3%
Covered Lines: 1570
Relevant Lines: 1964

💛 - Coveralls

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 83.83838% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 80.08%. Comparing base (daf6580) to head (066e52b).

Files Patch % Lines
src/compiler_pass.jl 77.77% 20 Missing ⚠️
src/utils.jl 88.78% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
- Coverage   80.28%   80.08%   -0.21%     
==========================================
  Files          21       21              
  Lines        1841     1968     +127     
==========================================
+ Hits         1478     1576      +98     
- Misses        363      392      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sunxd3 sunxd3 changed the title Improve Collectvariables Improve Collectvariables again Feb 28, 2024
@sunxd3
Copy link
Member Author

sunxd3 commented Feb 28, 2024

@yebai can you give this PR a quick pass through?

@sunxd3 sunxd3 merged commit ff60d5d into master Feb 29, 2024
14 checks passed
@sunxd3 sunxd3 deleted the sunxd/improve_collectvariables branch February 29, 2024 17:04
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.

1 participant