nest-simulator
nest-simulator copied to clipboard
Correct errors in slicing of node collections
This PR fixes #3108 by providing correct NodeCollection::{rank,thread}_local_begin(()
implementations for composite node collections.
To do:
- [x] Improve documentation of algorithm for selection of first nc entry
- [x] Extend set of tests
- [x] Move
slice_positions_if_sliced_nc()
code to more suitable location
I removed the ConnBuilder refactoring (see #3106) from this PR to reduce complexity and ensure we can integrate this bug-fixing PR asap. The refactoring can then following in a later PR.
@mlober @gtrensch This PR is ready for review now. I have reduced the scope by postponing the refactoring of ConnBuilders to use local iterators. So this is a pure bugfix PR and would be nice to get into NEST 3.7.
@diesmann You may want to check the documentation in numerics.h/cpp.
Switching temporarily to draft again since I discovered that the "spatial" property of a layer will be returned without "position" entry if no nodes on a rank. An empty positions tuple should be returned. I will fix this shortly, the underlying algorithm is not concerned, so @gtrensch you can proceed with the review.
@jstapmanns @gtrensch It turned out that there was a corner case I had overlooked, namely when the step was a multiple of the period or the other way around. There were both technical errors (returning invalid_index and operating on it before testing) as well as and a logical error (not using lcm(step, period) in a place that needed it). While working on fixing this, I discovered slight possiblities for simplification, and I improved documentation. I also introduced local variables in one place to make the code more explicit and hopefully more readable. The tests in test_issue_3108 are much extended and are now run for 1, 3 and 4 MPI processes.
@heplesser I have run some tests. Unfortunately, there is still a problem when using a mask:
nest.lib.hl_api_exceptions.Invalid NodeCollection iterator (composite element beyond specified end element): Invalid NodeCollection iterator (composite element beyond specified end element) in SLI function GetMetadata_g:
The problem occurs in the first test case of Miriam's test script when running with 3 MPI processes.
@heplesser I have run some tests. Unfortunately, there is still a problem when using a mask:
nest.lib.hl_api_exceptions.Invalid NodeCollection iterator (composite element beyond specified end element): Invalid NodeCollection iterator (composite element beyond specified end element) in SLI function GetMetadata_g:
The problem occurs in the first test case of Miriam's test script when running with 3 MPI processes.
@gtrensch Ignore my previous (now edited) post, I can reproduce the problem now.
@gtrensch I understood the problem now. The problem is that parts_[pix].size()
here returns the full size of the underlying node collection (before picking out the one node), instead of 1. I am currently evaluating how to solve this, hope to have a solution over lunch.
Making progress, but some problems remain, so back to draft.
@gtrensch @jstapmanns @diesmann After much hard work, I believe I have solved all problems now and that the testsuite is broad enough to cover all eventualities. Kindly review the new version of the PR. I suggest you start with the documentation near the beginning of node_collection.h
.
@gtrensch @jstapmanns Ping!
The author of the original model with which the problem was originally discovered has reported that the full model now works perfectly!