Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Add TABLE statement#1247

Merged
JCGoran merged 36 commits into
masterfrom
jelic/neuron_table
Jun 3, 2024
Merged

Add TABLE statement#1247
JCGoran merged 36 commits into
masterfrom
jelic/neuron_table

Conversation

@JCGoran

@JCGoran JCGoran commented May 2, 2024

Copy link
Copy Markdown
Contributor

Needs #1260.

@JCGoran JCGoran added the NEURON codegen Work toward NEURON code generation label May 2, 2024
@codecov-commenter

codecov-commenter commented May 2, 2024

Copy link
Copy Markdown

Codecov Report

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

Project coverage is 85.50%. Comparing base (341b89e) to head (d224278).
Report is 3 commits behind head on master.

Files Patch % Lines
src/codegen/codegen_neuron_cpp_visitor.cpp 20.37% 43 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1247      +/-   ##
==========================================
- Coverage   86.24%   85.50%   -0.75%     
==========================================
  Files         178      178              
  Lines       13299    13446     +147     
==========================================
+ Hits        11470    11497      +27     
- Misses       1829     1949     +120     

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

@bbpbuildbot

This comment has been minimized.

Comment thread src/codegen/codegen_neuron_cpp_visitor.cpp
Comment thread src/codegen/codegen_neuron_cpp_visitor.cpp Outdated
Comment thread src/codegen/codegen_neuron_cpp_visitor.cpp Outdated
@bbpbuildbot

This comment has been minimized.

@pramodk pramodk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is a draft but I quickly skimmed through it.

Comment thread test/usecases/hodgkin_huxley/hodhux.mod
Comment thread src/codegen/codegen_neuron_cpp_visitor.cpp
@bbpbuildbot

This comment has been minimized.

@JCGoran JCGoran force-pushed the jelic/neuron_table branch from 503b040 to 25b8d83 Compare May 13, 2024 14:14
@bbpbuildbot

This comment has been minimized.

@JCGoran JCGoran force-pushed the jelic/neuron_table branch from 25b8d83 to 407e7b8 Compare May 15, 2024 10:13
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 15, 2024
@bbpbuildbot

This comment has been minimized.

bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 15, 2024
@bbpbuildbot

This comment has been minimized.

bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 24, 2024
@bbpbuildbot

This comment has been minimized.

bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 27, 2024
@bbpbuildbot

This comment has been minimized.

Now tests the following:
- whether FUNCTIONs support TABLEs
- whether PROCEDUREs support TABLEs
- what's the accuracy when using a TABLE vs. not using a table
- whether the results of the calculation outside of the range [lowest,
  highest] is clipped to the functions evaluated at those arguments
- whether changing the dependencies actually triggers recomputation of
  the table
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 28, 2024
@bbpbuildbot

This comment has been minimized.

@JCGoran

JCGoran commented May 28, 2024

Copy link
Copy Markdown
Contributor Author

One should probably check if multiple tables are permitted and work. The reason is that we do use both sig and sigmoid to mangle names. Therefore, the question is can one have two different proceedures that both compute (a) sig (with different values) and both tabulate their sig.

It seems this will not error out at the parsing stage, but will at the compilation stage:

NEURON {
    SUFFIX minimal
    RANGE v1, v2
    GLOBAL c1, c2
}

PARAMETER {
    c1 = 1
    c2 = 2
}

ASSIGNED {
    v1
    v2
}

PROCEDURE p1(arg) {
    TABLE v1, v2 DEPEND c1, c2 FROM -1 TO 1 WITH 100
    v1 = c1 * arg + c2
    v2 = c2 * arg + c1
}

PROCEDURE p2(arg) {
    TABLE v1, v2 DEPEND c1, c2 FROM -5 TO 5 WITH 2000
    v1 = c1 * arg
    v2 = c2 * arg
}

due to redefinitions of v1 and v2 tables:

 -> Compiling arm64/ex.cpp
arm64/ex.cpp:220:17: error: redefinition of '_t_v1'
 static double *_t_v1;
                ^
arm64/ex.cpp:218:17: note: previous definition is here
 static double *_t_v1;
                ^
arm64/ex.cpp:221:17: error: redefinition of '_t_v2'
 static double *_t_v2;
                ^
arm64/ex.cpp:219:17: note: previous definition is here
 static double *_t_v2;
                ^
2 errors generated.

so I think it's safe to assume NOCMODL does not support duplicate TABLE variables. I'll see if I can add this check in NMODL as part of one of the visitors. EDIT Fixed in #1280

Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/simulate.py
Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/simulate.py Outdated
Comment thread test/usecases/table/table.mod Outdated
Comment thread src/codegen/codegen_cpp_visitor.hpp Outdated
Comment thread src/codegen/codegen_neuron_cpp_visitor.cpp Outdated
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request May 29, 2024
@bbpbuildbot

This comment has been minimized.

bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Jun 3, 2024
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Jun 3, 2024
@bbpbuildbot

Copy link
Copy Markdown
Collaborator

Logfiles from GitLab pipeline #214372 (:white_check_mark:) have been uploaded here!

Status and direct links:

@JCGoran JCGoran merged commit b4ef537 into master Jun 3, 2024
@JCGoran JCGoran deleted the jelic/neuron_table branch June 3, 2024 08:32
JCGoran added a commit to neuronsimulator/nrn that referenced this pull request Mar 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

NEURON codegen Work toward NEURON code generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants