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

Support for Random number generator as language construct #581

Closed
wants to merge 11 commits into from

Conversation

ohm314
Copy link
Contributor

@ohm314 ohm314 commented Apr 12, 2021

As described in #383 this PR introduces a native random type into NMODL based on the random123 implementation. Having support from random numbers in the language will allow us to drop a lot of VERBATIM code and unifies semantics and implementation of random numbers in CoreNEURON (and NEURON) mechanisms.

Status

  • Tests for parsing
  • Tests for code generation
  • AST definition in modl
  • Bison production rules
  • semantic validation pass
  • supporting data structures for code generation
  • C++ code generation

How to test

Look at the unit tests in test/unit/parser.cpp.

@pramodk
Copy link
Contributor

pramodk commented Apr 29, 2021

@ohm314: Is there any other items you have locally? Or, this is ready to discuss with @alkino?

@ohm314
Copy link
Contributor Author

ohm314 commented Apr 29, 2021

No local items - I will continue work here in a couple weeks but alternatively we can discuss with @alkino sooner. Did you have a chance to look at the PR in its current state? macos tests failed because of some homebrew issue.

@ohm314
Copy link
Contributor Author

ohm314 commented Apr 29, 2021

The last thing I was doing, was looking into netstim to understand a little better code generation and what can be factored out. I wanted to continue with this task once I finish up a few other items that were waiting for a long time.

@pramodk
Copy link
Contributor

pramodk commented Apr 29, 2021

Ok, yes! we wanted to have hand-written netstim cpp code before changing code generation pass!

Omar Awile added 7 commits September 20, 2023 11:15
This adds parsing and AST tree construction for the new NMODL RANDOM
type.

See #383
- Updated parsing taking some of @pramodk's ideas in #383 into account
- Implemented semantic validation for distribution on random statement
- Improved and extended tests
- Added a map holding the distribution functions of all random
  variables ready for code generation.
- Various small fixes and improvements.
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (441a3b1) 69.94% compared to head (f84f8b4) 69.57%.
Report is 7 commits behind head on master.

❗ Current head f84f8b4 differs from pull request most recent head d1dde27. Consider uploading reports for the commit d1dde27 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #581      +/-   ##
==========================================
- Coverage   69.94%   69.57%   -0.38%     
==========================================
  Files         188      190       +2     
  Lines       25647    25960     +313     
==========================================
+ Hits        17939    18061     +122     
- Misses       7708     7899     +191     
Files Coverage Δ
src/codegen/codegen_helper_visitor.hpp 100.00% <ø> (ø)
src/lexer/nmodl_utils.cpp 95.39% <100.00%> (+0.03%) ⬆️
src/lexer/token_mapping.cpp 96.15% <ø> (ø)
src/main.cpp 71.36% <100.00%> (+0.13%) ⬆️
src/symtab/symbol_properties.hpp 92.00% <ø> (ø)
src/visitors/check_random_statement_visitor.hpp 100.00% <100.00%> (ø)
test/unit/modtoken/modtoken.cpp 100.00% <100.00%> (ø)
test/unit/parser/parser.cpp 100.00% <100.00%> (ø)
src/visitors/check_random_statement_visitor.cpp 93.33% <93.33%> (ø)
src/codegen/codegen_info.hpp 88.46% <0.00%> (-11.54%) ⬇️
... and 1 more

... and 12 files with indirect coverage changes

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

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

tristan0x and others added 4 commits October 5, 2023 16:19
* First proposal of improvements on C++ generator

* reduce number of copies
* `CodePrinter::add_text`:
  * now supports multiple arguments
  * use it instead of trivial but expensive call to `fmt::format`.
* `CodePrinter::add_multi_line`:
  * rework to work with C++ raw string literals
  * used it instead of 3 or more consecutive `add_line`
* `CodePrinter::start_block`: rename to `push_block`
* `CodePrinter::end_block`: rename to pop_block
* CodegenCppVisitor::visit_program more visible
* Try removing python3-importlib-metadata

Co-authored-by: Nicolas Cornu <[email protected]>
Co-authored-by: Ioannis Magkanaris <[email protected]>
Co-authored-by: Erik Heeren <[email protected]>
* Remove wrapper_printer and target_printer since we only print a single C++ file now for all the backends
* Rename C to C++ in multiple places
- Added a map holding the distribution functions of all random
  variables ready for code generation.
- Various small fixes and improvements.
- Reworked the semtantic checking
- lots of code generation (but not all)
@bbpbuildbot
Copy link
Collaborator

Logfiles from GitLab pipeline #158851 (:no_entry:) have been uploaded here!

Status and direct links:

@1uc
Copy link
Collaborator

1uc commented Mar 27, 2024

Implemented via a different PR.

@1uc 1uc closed this Mar 27, 2024
@1uc 1uc deleted the enh/random branch July 12, 2024 14:03
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.

6 participants