This repository was archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
In memory model transfer between neuron and coreneuron #114
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
283ee1b
* move coreneuron toward full c++
fouriaux a18f77e
Update mod2c to new commit
pramodk d129dbb
fix ivocvect vector compatibility and declarations
fouriaux 32c4b1b
fixing core_read and core_write to be out of coreneuron namespace
fouriaux e80852c
add missing prototype
fouriaux 9a9aa18
update mod2c
fouriaux 7afb97d
update mod2c link
fouriaux f6a80aa
update submodule
fouriaux a812e74
fix public API of coreneuron to explose core_psolve
fouriaux aabed5d
add pulbic header
fouriaux a7d0c9b
kinderiv.h has prototype declaration for euler methods
pramodk 859a6a9
public header accessible from C, clean up unused arguments
fouriaux 0e17acd
Changes to integrate with neurodamus: psolve_core renamed and added -…
pramodk ba4105a
Merge branch 'master' into full_cpp_interface
pramodk 95798d8
mod2c updated
pramodk a7d827b
W.I.P for fixup openACC version
fouriaux ca893d6
OpenACC pragma annotation was missing for kernels using euler
pramodk 992000f
cudaMemset wrong pointer fix
pramodk 9a572b7
User provided flags should take precedence
pramodk f639ed7
Merge remote-tracking branch 'origin/euler_acc' into full_cpp_interface
pramodk 18692d9
Removed unnecessary acc declare annotations: actual errors are coming…
pramodk 503ff8d
Fix issue while compiling with -DENABLE_MPI=OFF
pramodk f9facdc
Merge branch 'master' into full_cpp_interface
pramodk 66f0a4f
fix mpi build
fouriaux fb26434
Direct transfer of model from NEURON to CoreNeuron without using files.
nrnhines 7c5b70a
Direct transfer of globals.dat info in place.
nrnhines a6d0339
Gap junction direct transfer. Change callback prefix to nrn2core_ .
nrnhines 9f97ead
Phase1 direct transfer.
nrnhines 642e6f9
Seems to work with direct transfer of data (but phase2 dat files
nrnhines fe0cde6
Direct transfer of dat2 to coreneuron almost works but
nrnhines 4bb4cc8
Direct transfer works for ringtest.
nrnhines 2867348
Merge branch 'master' into nrn2coredirect
nrnhines a372469
Update funding notice with latest HBP and NI grants
pramodk ca57775
Merge branch 'master' into nrn2coredirect
pramodk 6747aba
Update test dataset
pramodk c969af1
coreneuron_embedded_run does not read any files but needs info about
nrnhines 7f769a4
Fix coreneuron gap junction direct transfer bugs.
nrnhines f53a269
coreneuron_embedded_run takes tstop as an argument.
nrnhines 89d47ed
Changed the last arg of coreneuron_embedded_run to const char* arg
nrnhines 99d422e
For direct transfer, if OMP_NUM_THREADS is not set then
nrnhines 34ff7ee
Allow CoreNEURON to send data version to NEURON
nrnhines 92d8101
Update Michael's branch with clang-format
pramodk a459e3a
Refactor argument parsing logic with strtok
pramodk 885d035
Fix memory leaks :
pramodk 450409d
Merge branch 'master' into nrn2coredirect_master
pramodk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ THE POSSIBILITY OF SUCH DAMAGE. | |
#include "coreneuron/nrnoc/nrnoc_decl.h" | ||
#include "coreneuron/nrnmpi/nrnmpi.h" | ||
#include "coreneuron/nrniv/nrniv_decl.h" | ||
#include "coreneuron/nrniv/nrnmutdec.h" | ||
#include "coreneuron/nrniv/output_spikes.h" | ||
#include "coreneuron/nrniv/nrn_checkpoint.h" | ||
#include "coreneuron/utils/endianness.h" | ||
|
@@ -54,9 +55,86 @@ THE POSSIBILITY OF SUCH DAMAGE. | |
#include "coreneuron/nrniv/partrans.h" | ||
#include "coreneuron/nrniv/multisend.h" | ||
#include "coreneuron/utils/file_utils.h" | ||
#include "coreneuron/nrniv/nrn2core_direct.h" | ||
#include <string.h> | ||
#include <climits> | ||
|
||
extern "C" { | ||
const char* corenrn_version() { | ||
return coreneuron::bbcore_write_version; | ||
} | ||
|
||
/** | ||
* If "export OMP_NUM_THREADS=n" is not set then omp by default sets | ||
* the number of threads equal to the number of cores on this node. | ||
* If there are a number of mpi processes on this node as well, things | ||
* can go very slowly as there are so many more threads than cores. | ||
* Assume the NEURON users pc.nthread() is well chosen if | ||
* OMP_NUM_THREADS is not set. | ||
*/ | ||
void set_openmp_threads(int nthread) { | ||
#if defined(_OPENMP) | ||
if (!getenv("OMP_NUM_THREADS")) { | ||
omp_set_num_threads(nthread); | ||
} | ||
#endif | ||
} | ||
|
||
/** | ||
* Convert char* containing arguments from neuron to char* argv[] for | ||
* coreneuron command line argument parser. | ||
*/ | ||
char* prepare_args(int& argc, char**& argv, int use_mpi, const char* arg) { | ||
// first construct all arguments as string | ||
std::string args(arg); | ||
args.insert(0, " coreneuron "); | ||
if (use_mpi) { | ||
args.append(" -mpi "); | ||
} | ||
|
||
// we can't modify string with strtok, make copy | ||
char* first = strdup(args.c_str()); | ||
const char* sep = " "; | ||
|
||
// first count the no of argument | ||
char* token = strtok(first, sep); | ||
argc = 0; | ||
while (token) { | ||
token = strtok(NULL, sep); | ||
argc++; | ||
} | ||
free(first); | ||
|
||
// now build char*argv | ||
argv = new char*[argc]; | ||
first = strdup(args.c_str()); | ||
token = strtok(first, sep); | ||
for (int i = 0; token; i++) { | ||
argv[i] = token; | ||
token = strtok(NULL, sep); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only rank 0 should print? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. unfortunately, coreneuron has not started mpi yet and nrniv did not pass its version of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were for debugging and can be removed |
||
|
||
// return actual data to be freed | ||
return first; | ||
} | ||
|
||
int corenrn_embedded_run(int nthread, int have_gaps, int use_mpi, const char* arg) { | ||
corenrn_embedded = 1; | ||
corenrn_embedded_nthread = nthread; | ||
coreneuron::nrn_have_gaps = have_gaps; | ||
|
||
set_openmp_threads(nthread); | ||
int argc = 0; | ||
char** argv; | ||
char* new_arg = prepare_args(argc, argv, use_mpi, arg); | ||
solve_core(argc, argv); | ||
free(new_arg); | ||
delete[] argv; | ||
|
||
return corenrn_embedded; | ||
} | ||
} | ||
|
||
#if 0 | ||
#include <fenv.h> | ||
#define NRN_FEEXCEPT (FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) | ||
|
@@ -120,7 +198,8 @@ void nrn_init_and_load_data(int argc, | |
mk_mech(nrnopt_get_str("--datpath").c_str()); | ||
|
||
// read the global variable names and set their values from globals.dat | ||
set_globals(nrnopt_get_str("--datpath").c_str(), nrnopt_get_flag("--seed"), nrnopt_get_int("--seed")); | ||
set_globals(nrnopt_get_str("--datpath").c_str(), nrnopt_get_flag("--seed"), | ||
nrnopt_get_int("--seed")); | ||
|
||
report_mem_usage("After mk_mech"); | ||
|
||
|
@@ -285,7 +364,6 @@ extern "C" int solve_core(int argc, char** argv) { | |
reports_needs_finalize = configs.size(); | ||
} | ||
} | ||
|
||
// initializationa and loading functions moved to separate | ||
nrn_init_and_load_data(argc, argv, configs.size() > 0); | ||
std::string checkpoint_path = nrnopt_get_str("--checkpoint"); | ||
|
@@ -329,7 +407,7 @@ extern "C" int solve_core(int argc, char** argv) { | |
|
||
// register all reports into reportinglib | ||
double min_report_dt = INT_MAX; | ||
for (int i = 0; i < configs.size(); i++) { | ||
for (size_t i = 0; i < configs.size(); i++) { | ||
register_report(dt, tstop, delay, configs[i]); | ||
if (configs[i].report_dt < min_report_dt) { | ||
min_report_dt = configs[i].report_dt; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we transfer these to single header? (nrn2core_direct.h)
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 thought they needed a separare declaration in the header (extern) and then a definition in
some file (memory to hold the function pointer)