-
Notifications
You must be signed in to change notification settings - Fork 123
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
Callback from CoreNEURON to help transfer data to NEURON. #717
Conversation
Help for the transfer of voltage, i_membrane_, and mechanism data. Strategy is to pass a pointer which is used by CoreNEURON to copy data which may have been reordered due to SoA and permutation.
Add a more comprehensive data return test.
Added artificial cell test.
src/nrniv/nrnbbcore_write.cpp
Outdated
typedef std::pair<int, double**> Deferred_pair; | ||
typedef std::map<int, Deferred_pair> Deferred_map; | ||
typedef std::vector<Deferred_map> Deferred_Type2ArtData; | ||
//typedef std::vector<std::map<int, std::pair<int, double**> > > Deferred_Type2ArtData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the right way to do this. I had trouble with the combined typedef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef std::vector<std::map<int, std::pair<int, double**> > > Deferred_Type2ArtData;
should compile. do you see any error?
alternatively, C++11 way is to use using
.
using Deferred_Type2ArtData = std::vector<std::map<int, std::pair<int, double**>>>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take detailed look bit later but just quick comments here.
src/nrniv/nrnbbcore_write.cpp
Outdated
typedef std::pair<int, double**> Deferred_pair; | ||
typedef std::map<int, Deferred_pair> Deferred_map; | ||
typedef std::vector<Deferred_map> Deferred_Type2ArtData; | ||
//typedef std::vector<std::map<int, std::pair<int, double**> > > Deferred_Type2ArtData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef std::vector<std::map<int, std::pair<int, double**> > > Deferred_Type2ArtData;
should compile. do you see any error?
alternatively, C++11 way is to use using
.
using Deferred_Type2ArtData = std::vector<std::map<int, std::pair<int, double**>>>;
travis ci test is failing :
|
CoreNEURON allocates some pad space even if real size of nodes is 0. So cannot decide whether to copy data or change the return pointers based on whether the pointer is NULL.
This is consistent on travis but I have so far been unable to reproduce the segfault on my desktop. It appears that travis is using the correct CoreNeuron.
of a repeated
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good for merge when segfault is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost good to merge. I have few remarks, could you take a look?
if (corenrn_direct && nrn_nthread > 0) { | ||
deferred_type2artdata.resize(nrn_nthread); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand why we are resizing to nrn_nthread
in part2_clean function. I expected to completely delete deferred_type2artdata
in cleanup function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved the comment to:
// clean up the art Memb_list of CellGroup[].mlwithart
// But if multithread and direct transfer mode, defer deletion of
// data for artificial cells, so that the artificial cell ml->data
// can be used when nrnthreads_type_return is called.
I think it also helps to see the comment in nrnthreads_type_return, which gives the justification for all this.
// The single thread case is easy
...
// mk_tml_with_art() created a cgs[id].mlwithart which appended
// artificial cells to the end. Turns out that
// cellgroups_[tid].type2ml[type]
// is the Memb_list we need. Sadly, by the time we get here, cellgroups_
// has already been deleted. So we defer deletion of the necessary
// cellgroups_ portion (deleting it on return from nrncore_run).
Help for the transfer of voltage, i_membrane_, and mechanism data.
Strategy is to pass a pointer which is used by CoreNEURON to copy
data which may have been reordered due to SoA and permutation.
Interacts with BlueBrain/CoreNeuron#382