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

Extend CoreNEURON POINTER transfer to any RANGE variable in a NRN_THREAD #1622

Merged
merged 29 commits into from
Mar 10, 2022

Conversation

nrnhines
Copy link
Member

@nrnhines nrnhines commented Feb 7, 2022

Prior to this, POINTER was restricted to point to voltage.
This change depends on BlueBrain/CoreNeuron#772

TODO:

Requires bbcore_write_version 1.5
The test requires merge of BlueBrain/CoreNeuron#748

To test (until BlueBrain/CoreNeuron#748 is merged)

git checkout hines/POINTER-to-RANGE
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=install -DPYTHON_EXECUTABLE=`which python3` -DNRN_ENABLE_RX3D=OFF -DCMAKE_BUILD_TYPE=Debug  -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_TESTS=ON
(cd ../external/coreneuron/ ; git checkout hines/before-after ; git pull ; git checkout hines/POINTER-to-RANGE ; git pull ; git merge hines/before-after)
ninja install
ctest -R test_pointer_py_cpu

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2022

Codecov Report

Merging #1622 (70c9569) into master (4defcc3) will increase coverage by 0.07%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1622      +/-   ##
==========================================
+ Coverage   45.22%   45.30%   +0.07%     
==========================================
  Files         551      551              
  Lines      111198   111206       +8     
==========================================
+ Hits        50289    50380      +91     
+ Misses      60909    60826      -83     
Impacted Files Coverage Δ
.../nrniv/nrncore_write/callbacks/nrncore_callbacks.h 100.00% <ø> (ø)
src/nrniv/nrncore_write/data/cell_group.cpp 91.44% <ø> (+1.06%) ⬆️
src/nrniv/nrncore_write/data/cell_group.h 100.00% <ø> (ø)
src/nrncvode/netcvode.cpp 66.49% <14.28%> (+0.30%) ⬆️
...rniv/nrncore_write/callbacks/nrncore_callbacks.cpp 95.76% <100.00%> (+0.19%) ⬆️
src/nrniv/nrncore_write/io/nrncore_io.cpp 75.36% <100.00%> (+0.45%) ⬆️
src/nrnmpi/bbsmpipack.cpp 82.56% <0.00%> (-10.77%) ⬇️
src/parallel/bbsclimpi.cpp 50.00% <0.00%> (-8.14%) ⬇️
src/parallel/bbssrvmpi.cpp 42.16% <0.00%> (-6.03%) ⬇️
src/parallel/bbs.cpp 74.26% <0.00%> (-1.69%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4defcc3...70c9569. Read the comment docs.

@pramodk pramodk modified the milestones: Frontiers paper, Release v8.1 Feb 28, 2022
@nrnhines nrnhines mentioned this pull request Feb 28, 2022
nrnhines added 2 commits March 2, 2022 09:43
There is likely a but in WATCH statement when checkpoint with
cell-permute 1. So that test is currently turned off.
@nrnhines
Copy link
Member Author

nrnhines commented Mar 4, 2022

f88f823 test does reveal a bug in CoreNEURON checkpointing but it has nothing to do with the WATCH statement either. It has to do with some kind of permutation problem so that the PreSyn is not properly associated with the correct AxialPP instance (at least after checkpoint read). I.e the visible symptom is that gid's for the spike raster file are wrong. But if gids are stored in the AxialPP instance itself as a PARAMETER RANGE variable, and one

NET_RECEIVE(w) {
  if (id > 0) {
    printf("%g %g %g zzz\n", t, id, iaSum)
  }
...

one sees the correct gid in the id range variable associated with the proper time and value. In other words, the first few spikes after a checkpoint restart prints

5.025 124 0.501053 zzz
5.175 111 0.506255 zzz
5.275 126 0.505367 zzz
5.55 104 0.519031 zzz

but the the corresponding spikes in the spike raster out.dat file are

5.025   127
5.175   114
5.275   103
5.55    124

@nrnhines
Copy link
Member Author

nrnhines commented Mar 5, 2022

@pramod This is ready for review with respect to POINTER functionality. However, I would like to explicitly support the handling of multiple BEFORE SETUP blocks in a single mod file. The axial_pp.mod, axial.mod, and axial.inc files can benefit from that in terms of reducing copies of identical code fragments. However it may involve a similar change over on the CoreNEURON side as well for BlueBrain/CoreNeuron#772

@pramodk
Copy link
Member

pramodk commented Mar 7, 2022

@nrnhines : As mentioned in BlueBrain/CoreNeuron#772, lets have a separate PR so that we can get this merged?

@nrnhines
Copy link
Member Author

nrnhines commented Mar 7, 2022

I agree. I'll defer the change to a separate pull request after this is merged.

Copy link
Member

@alexsavulescu alexsavulescu left a comment

Choose a reason for hiding this comment

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

LGTM. Some cosmetic touches.

src/nrniv/nrncore_write/callbacks/nrncore_callbacks.cpp Outdated Show resolved Hide resolved
test/coreneuron/test_pointer.py Outdated Show resolved Hide resolved
test/coreneuron/test_pointer.py Outdated Show resolved Hide resolved
@pramodk
Copy link
Member

pramodk commented Mar 10, 2022

Just for the record - CircleCI failure seems like a hiccup:

Reading package lists... Done
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Failed to fetch http://us-east-1.ec2.ports.ubuntu.com/ubuntu-ports/dists/focal-updates/main/binary-arm64/Packages.xz  File has unexpected size (1137644 != 1139168). Mirror sync in progress? [IP: 34.207.203.110 80]
   Hashes of expected file:
    - Filesize:1139168 [weak]
    - SHA256:83e3736496f0f874e48d6914bae3a62a5f830581db7071bf6520577bd20e7102
    - SHA1:81166858c09120d9bdd1680d1c565cabfe10d16b [weak]
    - MD5Sum:c3057169215bd6bdeef8ddf39effab1b [weak]
   Release file created at: Thu, 10 Mar 2022 17:53:55 +0000
E: Failed to fetch http://us-east-1.ec2.ports.ubuntu.com/ubuntu-ports/dists/focal-updates/universe/binary-arm64/Packages.xz  
E: Some index files failed to download. They have been ignored, or old ones used instead.

Have retriggered the CI.

@pramodk pramodk removed the request for review from olupton March 10, 2022 19:01
Copy link
Member

@pramodk pramodk left a comment

Choose a reason for hiding this comment

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

LGTM

NEURON {
THREADSAFE
RANGE ri, ia, im
POINTER pv, pia, pim
Copy link
Member

Choose a reason for hiding this comment

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

@nrnhines : to clarify - now not all POINTERs are invalid in the context of CoreNEURON. Only POINTERS that are used for explicit memory allocation needs to be handled with bbcore_read and bbcore_write. Right? We can add this clarification in #1678.

Copy link
Member Author

Choose a reason for hiding this comment

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

@pramodk That is correct. That has always been correct for POINTER to voltage.

Comment on lines +300 to +311
# sometimes roundoff to %.8g gives different sort.
srun("sortspike {}/temp {}/nrn.spk".format(dir, dir))

srun("sortspike {}/out.dat {}/out.spk".format(dir, dir))
srun("cmp {}/out.spk {}/nrn.spk".format(dir, dir))

cmd = "cat"
for i in chkpntdirs:
cmd = cmd + " " + i + "/out.dat"
srun(cmd + " > " + dir + "/temp")
srun("sortspike {}/temp {}/chkptout.spk".format(dir, dir))
srun("cmp {}/out.spk {}/chkptout.spk".format(dir, dir))
Copy link
Member

Choose a reason for hiding this comment

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

just a comment: this all looks bash embedded inside python 😅 but I think we can leave this. In #1682 Olli refactor similar test inside CMake but this one doesn't include MPI or similar options. So hopefully we will be able to clean this after 8.1 by bringing coreneuron integrated into neuron.

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.

5 participants