NEURON
main1.cpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================.
7 */
8 
9 /**
10  * @file main1.cpp
11  * @date 26 Oct 2014
12  * @brief File containing main driver routine for CoreNeuron
13  */
14 
15 #include <cstring>
16 #include <climits>
17 #include <dlfcn.h>
18 #include <filesystem>
19 #include <memory>
20 #include <vector>
21 
24 #include "coreneuron/nrnconf.h"
27 #include "coreneuron/mpi/nrnmpi.h"
47 
48 namespace fs = std::filesystem;
49 
50 extern "C" {
51 const char* corenrn_version() {
53 }
54 
56 
57 /**
58  * If "export OMP_NUM_THREADS=n" is not set then omp by default sets
59  * the number of threads equal to the number of cores on this node.
60  * If there are a number of mpi processes on this node as well, things
61  * can go very slowly as there are so many more threads than cores.
62  * Assume the NEURON users pc.nthread() is well chosen if
63  * OMP_NUM_THREADS is not set.
64  */
65 void set_openmp_threads(int nthread) {
66 #if defined(_OPENMP)
67  if (!getenv("OMP_NUM_THREADS")) {
68  omp_set_num_threads(nthread);
69  }
70 #endif
71 }
72 
73 /**
74  * Convert char* containing arguments from neuron to char* argv[] for
75  * coreneuron command line argument parser.
76  */
77 char* prepare_args(int& argc, char**& argv, std::string& args) {
78  // we can't modify string with strtok, make copy
79  char* first = strdup(args.c_str());
80  const char* sep = " ";
81 
82  // first count the no of argument
83  char* token = strtok(first, sep);
84  argc = 0;
85  while (token) {
86  token = strtok(nullptr, sep);
87  argc++;
88  }
89  free(first);
90 
91  // now build char*argv
92  argv = new char*[argc + 1];
93  first = strdup(args.c_str());
94  token = strtok(first, sep);
95  for (int i = 0; token; i++) {
96  argv[i] = token;
97  token = strtok(nullptr, sep);
98  }
99 
100  // make sure argv is terminated by NULL!
101  argv[argc] = nullptr;
102 
103  // return actual data to be freed
104  return first;
105 }
106 }
107 
108 namespace coreneuron {
109 void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, int is_init);
110 
111 // bsize = 0 then per step transfer
112 // bsize > 1 then full trajectory save into arrays.
115  for (int tid = 0; tid < nrn_nthread; ++tid) {
116  NrnThread& nt = nrn_threads[tid];
117  int n_pr;
118  int n_trajec;
119  int* types;
120  int* indices;
121  void** vpr;
122  double** varrays;
123  double** pvars;
124 
125  // bsize is passed by reference, the return value will determine if
126  // per step return or entire trajectory return.
127  (*nrn2core_get_trajectory_requests_)(
128  tid, bsize, n_pr, vpr, n_trajec, types, indices, pvars, varrays);
130  if (n_trajec) {
132  nt.trajec_requests = tr;
133  tr->bsize = bsize;
134  tr->n_pr = n_pr;
135  tr->n_trajec = n_trajec;
136  tr->vsize = 0;
137  tr->vpr = vpr;
138  tr->gather = new double*[n_trajec];
139  tr->varrays = varrays;
140  tr->scatter = pvars;
141  for (int i = 0; i < n_trajec; ++i) {
142  tr->gather[i] = legacy_index2pointer(types[i], indices[i], nt);
143  }
144  delete[] types;
145  delete[] indices;
146  }
147  }
148  }
149 }
150 
152  char* argv[],
153  CheckPoints& checkPoints,
154  bool is_mapping_needed,
155  bool run_setup_cleanup) {
156 #if defined(NRN_FEEXCEPT)
158 #endif
159 
160  /// profiler like tau/vtune : do not measure from begining
162 
163  // memory footprint after mpi initialisation
164  if (!corenrn_param.is_quiet()) {
165  report_mem_usage("After MPI_Init");
166  }
167 
168  // initialise default coreneuron parameters
169  initnrn();
170 
171  // set global variables
172  // precedence is: set by user, globals.dat, 34.0
174 
175 #if CORENEURON_ENABLE_GPU
177  fprintf(stderr,
178  "compiled with CORENEURON_ENABLE_GPU does not allow the combination of "
179  "--cell-permute=2 and "
180  "missing --gpu\n");
181  exit(1);
182  }
184  fprintf(stderr,
185  "compiled with OpenACC/CUDA does not allow the combination of --cuda-interface and "
186  "missing --gpu\n");
187  exit(1);
188  }
189 #endif
190 
191 // if multi-threading enabled, make sure mpi library supports it
192 #if NRNMPI
194  nrnmpi_check_threading_support();
195  }
196 #endif
197 
198  // Default path of files.dat is relative to datpath
199  if (corenrn_param.filesdat.empty()) {
201  }
202 
203  // read the global variable names and set their values from globals.dat
205 
206  // set global variables for start time, timestep and temperature
207  if (!corenrn_embedded) {
208  t = checkPoints.restore_time();
209  }
210 
211  if (corenrn_param.dt != -1000.) { // command line arg highest precedence
212  dt = corenrn_param.dt;
213  } else if (dt == -1000.) { // not on command line and no dt in globals.dat
214  dt = 0.025; // lowest precedence
215  }
216 
217  corenrn_param.dt = dt;
218 
219  rev_dt = (int) (1. / dt);
220 
221  if (corenrn_param.celsius != -1000.) { // command line arg highest precedence
223  } else if (celsius == -1000.) { // not on command line and no celsius in globals.dat
224  celsius = 34.0; // lowest precedence
225  }
226 
228 
229  // create net_cvode instance
230  mk_netcvode();
231 
232  // One part done before call to nrn_setup. Other part after.
233 
234  if (!corenrn_param.patternstim.empty()) {
236  }
237 
238  if (!corenrn_param.is_quiet()) {
239  report_mem_usage("Before nrn_setup");
240  }
241 
242  // set if need to interleave cells
246 
248  if (nrnmpi_myid == 0) {
249  printf(
250  " WARNING : GPU execution requires --cell-permute type 1 or 2. Setting it to 1.\n");
251  }
253  use_solve_interleave = true;
254  }
255 
256  // multisend options
259  use_phase2_ = (corenrn_param.ms_phases == 2) ? 1 : 0;
260 
261  // reading *.dat files and setting up the data structures, setting mindelay
263  is_mapping_needed,
264  checkPoints,
265  run_setup_cleanup,
266  corenrn_param.datpath.c_str(),
267  checkPoints.get_restore_path().c_str(),
269 
270  // Allgather spike compression and bin queuing.
272  int spkcompress = corenrn_param.spkcompress;
273  nrnmpi_spike_compress(spkcompress, (spkcompress ? true : false), use_multisend_);
274 
275  if (!corenrn_param.is_quiet()) {
276  report_mem_usage("After nrn_setup ");
277  }
278 
279  // Invoke PatternStim
280  if (!corenrn_param.patternstim.empty()) {
282  }
283 
284  /// Setting the timeout
285  nrn_set_timeout(200.);
286 
287  // show all configuration parameters for current run
288  if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
289  std::cout << corenrn_param << std::endl;
290  std::cout << " Start time (t) = " << t << std::endl << std::endl;
291  }
292 
293  // allocate buffer for mpi communication
295 
296  if (!corenrn_param.is_quiet()) {
297  report_mem_usage("After mk_spikevec_buffer");
298  }
299 
300  // In direct mode there are likely trajectory record requests
301  // to allow processing in NEURON after simulation by CoreNEURON
302  if (corenrn_embedded) {
303  // arg is additional vector size required (how many items will be
304  // written to the double*) but NEURON can instead
305  // specify that returns will be on a per time step basis.
307 
308  // In direct mode, CoreNEURON has exactly the behavior of
309  // ParallelContext.psolve(tstop). Ie a sequence of such calls
310  // without an intervening h.finitialize() continues from the end
311  // of the previous call. I.e., all initial state, including
312  // the event queue has been set up in NEURON. And, at the end
313  // all final state, including the event queue will be sent back
314  // to NEURON. Here there is some first time only
315  // initialization and queue transfer.
317  clear_spike_vectors(); // PreSyn send already recorded by NEURON
318  (*nrn2core_part2_clean_)();
319  }
320 
321  if (corenrn_param.gpu) {
322  // Copy nrnthreads to device only after all the data are passed from NEURON and the
323  // nrnthreads on CPU are properly set up
325  }
326 
327  if (corenrn_embedded) {
328  // Run nrn_init of mechanisms only to allocate any extra data needed on the GPU after
329  // nrnthreads are properly set up on the GPU
331  }
332 
333  if (corenrn_param.gpu) {
334  if (nrn_have_gaps) {
336  }
337  }
338 
339  // call prcellstate for prcellgid
341 }
342 
343 void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, int is_init) {
344  if (prcellgid >= 0) {
345  std::string prcellname{compute_gpu ? "acc_gpu" : "cpu"};
346  if (is_init) {
347  prcellname += "_init";
348  } else {
349  prcellname += "_t";
350  prcellname += std::to_string(t);
351  }
353  prcellstate(prcellgid, prcellname.c_str());
354  }
355 }
356 
357 /* perform forwardskip and call prcellstate for prcellgid */
358 void handle_forward_skip(double forwardskip, int prcellgid) {
359  double savedt = dt;
360  double savet = t;
361 
362  dt = forwardskip * 0.1;
363  t = -1e9;
364  dt2thread(-1.);
365 
366  for (int step = 0; step < 10; ++step) {
368  }
369 
370  if (prcellgid >= 0) {
371  prcellstate(prcellgid, "fs");
372  }
373 
374  dt = savedt;
375  t = savet;
376  dt2thread(-1.);
377 
378  // clear spikes generated during forward skip (with negative time)
380 }
381 
382 std::string cnrn_version() {
383  return version::to_string();
384 }
385 
386 
387 static void trajectory_return() {
389  for (int tid = 0; tid < nrn_nthread; ++tid) {
390  NrnThread& nt = nrn_threads[tid];
392  if (tr && tr->varrays) {
393  (*nrn2core_trajectory_return_)(tid, tr->n_pr, tr->bsize, tr->vsize, tr->vpr, nt._t);
394  }
395  }
396  }
397 }
398 
399 std::unique_ptr<ReportHandler> create_report_handler(const ReportConfiguration& config,
400  const SpikesInfo& spikes_info) {
401  std::unique_ptr<ReportHandler> report_handler;
402  if (config.format == "SONATA") {
403  report_handler = std::make_unique<SonataReportHandler>(spikes_info);
404  } else {
405  if (nrnmpi_myid == 0) {
406  printf(" WARNING : Report name '%s' has unknown format: '%s'.\n",
407  config.name.data(),
408  config.format.data());
409  }
410  return nullptr;
411  }
412  return report_handler;
413 }
414 
415 } // namespace coreneuron
416 
417 /// The following high-level functions are marked as "extern C"
418 /// for compat with C, namely Neuron mod files.
419 /// They split the previous solve_core so that intermediate init of external mechanisms can occur.
420 /// See mech/corenrnmech.cpp for the new all-in-one solve_core (not compiled into the coreneuron
421 /// lib since with nrnivmodl-core we have 'future' external mechanisms)
422 
423 using namespace coreneuron;
424 
425 #if NRNMPI && defined(NRNMPI_DYNAMICLOAD)
426 static void* load_dynamic_mpi(const std::string& libname) {
427  dlerror();
428  void* handle = dlopen(libname.c_str(), RTLD_NOW | RTLD_GLOBAL);
429  const char* error = dlerror();
430  if (error) {
431  std::string err_msg = std::string("Could not open dynamic MPI library: ") + error + "\n";
432  throw std::runtime_error(err_msg);
433  }
434  return handle;
435 }
436 #endif
437 
438 extern "C" void mk_mech_init(int argc, char** argv) {
439  // reset all parameters to their default values
441 
442  // read command line parameters and parameter config files
444 
445 #if NRNMPI
447 #ifdef NRNMPI_DYNAMICLOAD
448  // coreneuron rely on neuron to detect mpi library distribution and
449  // the name of the library itself. Make sure the library name is specified
450  // via CLI option.
451  if (corenrn_param.mpi_lib.empty()) {
452  throw std::runtime_error(
453  "For dynamic MPI support you must pass '--mpi-lib "
454  "/path/libcorenrnmpi_<name>.<suffix>` argument!\n");
455  }
456 
457  // neuron can call coreneuron multiple times and hence we do not
458  // want to initialize/load mpi library multiple times
459  static bool mpi_lib_loaded = false;
460  if (!mpi_lib_loaded) {
461  auto mpi_handle = load_dynamic_mpi(corenrn_param.mpi_lib);
462  mpi_manager().resolve_symbols(mpi_handle);
463  mpi_lib_loaded = true;
464  }
465 #endif
466  auto ret = nrnmpi_init(&argc, &argv, corenrn_param.is_quiet());
467  nrnmpi_numprocs = ret.numprocs;
468  nrnmpi_myid = ret.myid;
469  }
470 #endif
471 
472 #ifdef CORENEURON_ENABLE_GPU
473  if (corenrn_param.gpu) {
474  init_gpu();
479  }
480 #endif
481 
482  if (!corenrn_param.writeParametersFilepath.empty()) {
483  std::ofstream out(corenrn_param.writeParametersFilepath, std::ios::trunc);
484  out << corenrn_param.config_to_str(false, false);
485  out.close();
486  }
487 
488  // reads mechanism information from bbcore_mech.dat
489  mk_mech((corenrn_param.datpath).c_str());
490 }
491 
492 extern "C" int run_solve_core(int argc, char** argv) {
494 
495  std::vector<ReportConfiguration> configs;
496  std::vector<std::unique_ptr<ReportHandler>> report_handlers;
497  SpikesInfo spikes_info;
498  bool reports_needs_finalize = false;
499 
500  if (!corenrn_param.is_quiet()) {
501  report_mem_usage("After mk_mech");
502  }
503 
504  // Create outpath if it does not exist
505  if (nrnmpi_myid == 0) {
506  fs::create_directories(corenrn_param.outpath);
507  }
508 
509  if (!corenrn_param.reportfilepath.empty()) {
512  spikes_info);
513  reports_needs_finalize = !configs.empty();
514  }
515 
517 
518  // initializationa and loading functions moved to separate
519  {
520  Instrumentor::phase p("load-model");
521  nrn_init_and_load_data(argc, argv, checkPoints, !configs.empty());
522  }
523 
524  std::string output_dir = corenrn_param.outpath;
525 
526  if (nrnmpi_myid == 0) {
527  fs::create_directories(output_dir);
528  }
529 #if NRNMPI
531  nrnmpi_barrier();
532  }
533 #endif
534  bool compute_gpu = corenrn_param.gpu;
535 
536  nrn_pragma_acc(update device(celsius, secondorder, pi) if (compute_gpu))
537  nrn_pragma_omp(target update to(celsius, secondorder, pi) if (compute_gpu))
538  {
539  double v = corenrn_param.voltage;
540  double dt = corenrn_param.dt;
541  double delay = corenrn_param.mindelay;
542  double tstop = corenrn_param.tstop;
543 
544  if (tstop < t && nrnmpi_myid == 0) {
545  printf("Error: Stop time (%lf) < Start time (%lf), restoring from checkpoint? \n",
546  tstop,
547  t);
548  abort();
549  }
550 
551  // TODO : if some ranks are empty then restore will go in deadlock
552  // phase (as some ranks won't have restored anything and hence return
553  // false in checkpoint_initialize
554  if (!corenrn_embedded && !checkPoints.initialize()) {
555  nrn_finitialize(v != 1000., v);
556  }
557 
558  if (!corenrn_param.is_quiet()) {
559  report_mem_usage("After nrn_finitialize");
560  }
561 
562  // register all reports with libsonata
563  double min_report_dt = INT_MAX;
564  for (size_t i = 0; i < configs.size(); i++) {
565  std::unique_ptr<ReportHandler> report_handler = create_report_handler(configs[i],
566  spikes_info);
567  if (report_handler) {
568  report_handler->create_report(configs[i], dt, tstop, delay);
569  report_handlers.push_back(std::move(report_handler));
570  }
571  if (configs[i].report_dt < min_report_dt) {
572  min_report_dt = configs[i].report_dt;
573  }
574  }
575  // Set the buffer size if is not the default value. Otherwise use report.conf on
576  // register_report
579  }
580 
581  if (!configs.empty()) {
582  setup_report_engine(min_report_dt, delay);
583  configs.clear();
584  }
585 
586  // call prcellstate for prcellgid
588 
589  // handle forwardskip
590  if (corenrn_param.forwardskip > 0.0) {
591  Instrumentor::phase p("handle-forward-skip");
593  }
594 
595  /// Solver execution
597  Instrumentor::phase_begin("simulation");
599  Instrumentor::phase_end("simulation");
601 
602  // update cpu copy of NrnThread from GPU
604 
605  // direct mode and full trajectory gathering on CoreNEURON, send back.
606  if (corenrn_embedded) {
608  }
609 
610  // Report global cell statistics
611  if (!corenrn_param.is_quiet()) {
613  }
614 
615  // prcellstate after end of solver
617  }
618 
619  // write spike information to outpath
620  {
621  Instrumentor::phase p("output-spike");
622  output_spikes(output_dir.c_str(), spikes_info);
623  }
624 
625  // copy weights back to NEURON NetCon
627  // first update weights from gpu
629 
630  // store weight pointers
631  std::vector<double*> weights(nrn_nthread, nullptr);
632 
633  // could be one thread more (empty) than in NEURON but does not matter
634  for (int i = 0; i < nrn_nthread; ++i) {
636  }
637  (*nrn2core_all_weights_return_)(weights);
638  }
639 
640  if (corenrn_embedded) {
642  }
643 
644  {
645  Instrumentor::phase p("checkpoint");
646  checkPoints.write_checkpoint(nrn_threads, nrn_nthread);
647  }
648 
649  // must be done after checkpoint (to avoid deleting events)
650  if (reports_needs_finalize) {
651  finalize_report();
652  }
653 
654  // cleanup threads on GPU
655  if (corenrn_param.gpu) {
657  if (nrn_have_gaps) {
659  }
664  }
665 
666  // Cleaning the memory
667  nrn_cleanup();
668 
669  // tau needs to resume profile
671 
672 // mpi finalize
673 #if NRNMPI
675  nrnmpi_finalize();
676  }
677 #endif
678 
679  Instrumentor::phase_end("main");
680 
681  return 0;
682 }
static void nrnmpi_barrier()
std::string get_restore_path() const
double restore_time() const
todo : need to broadcast this rather than all reading a double
Version information.
#define v
Definition: md1redef.h:11
#define weights
Definition: md1redef.h:42
#define i
Definition: md1redef.h:19
nrn_pragma_acc(routine seq) nrn_pragma_omp(declare target) philox4x32_ctr_t coreneuron_random123_philox4x32_helper(coreneuron nrn_pragma_omp(end declare target) namespace coreneuron
Provide a helper function in global namespace that is declared target for OpenMP offloading to functi...
Definition: nrnran123.h:66
DLFCN_EXPORT void * dlopen(const char *file, int mode)
Definition: dlfcn.c:331
DLFCN_EXPORT char * dlerror(void)
Definition: dlfcn.c:548
#define RTLD_NOW
Definition: dlfcn.h:47
#define RTLD_GLOBAL
Definition: dlfcn.h:56
void nrn_feenableexcept()
Definition: hoc.cpp:84
static int argc
Definition: inithoc.cpp:45
static char ** argv
Definition: inithoc.cpp:46
int run_solve_core(int argc, char **argv)
Definition: main1.cpp:492
void(* nrn2core_part2_clean_)()
Definition: main1.cpp:55
void set_openmp_threads(int nthread)
If "export OMP_NUM_THREADS=n" is not set then omp by default sets the number of threads equal to the ...
Definition: main1.cpp:65
const char * corenrn_version()
Definition: main1.cpp:51
void mk_mech_init(int argc, char **argv)
initialize standard mechanisms from coreneuron
Definition: main1.cpp:438
char * prepare_args(int &argc, char **&argv, std::string &args)
Convert char* containing arguments from neuron to char* argv[] for coreneuron command line argument p...
Definition: main1.cpp:77
Function prototypes for the functions providing information about simulator memory usage.
printf
Definition: extdef.h:5
step
Definition: extdef.h:7
error
Definition: extdef.h:3
void move(Item *q1, Item *q2, Item *q3)
Definition: list.cpp:200
static void phase_end(const char *name)
static void phase_begin(const char *name)
void delete_gap_indices_from_device()
Definition: partrans.cpp:161
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
NrnThread * nrn_threads
Definition: multicore.cpp:56
static void trajectory_return()
Definition: main1.cpp:387
void nrn_init_and_load_data(int argc, char *argv[], CheckPoints &checkPoints, bool is_mapping_needed, bool run_setup_cleanup)
Definition: main1.cpp:151
bool use_phase2_
Definition: multisend.cpp:54
void nrn_finitialize(int setv, double v)
Definition: finitialize.cpp:40
void nrn_set_extra_thread0_vdata()
Definition: patternstim.cpp:48
void nrn_cleanup()
Definition: nrn_setup.cpp:725
bool nrn_use_bin_queue_
Flag to use the bin queue.
Definition: netcvode.cpp:39
int cellorder_nwarp
void handle_forward_skip(double forwardskip, int prcellgid)
Definition: main1.cpp:358
int prcellstate(int gid, const char *suffix)
void report_cell_stats()
Reports global cell statistics of the simulation.
Definition: nrn_stats.cpp:30
void core2nrn_data_return()
copy data back to NEURON.
int nrn_nthread
Definition: multicore.cpp:55
void nrn_setup(const char *filesdat, bool is_mapping_needed, CheckPoints &checkPoints, bool run_setup_cleanup, const char *datpath, const char *restore_path, double *mindelay)
Definition: nrn_setup.cpp:409
void get_nrn_trajectory_requests(int bsize)
Definition: main1.cpp:113
void mk_netcvode()
Definition: netcvode.cpp:41
bool nrn_have_gaps
variables defined in coreneuron library
Definition: partrans.cpp:21
void cnrn_target_delete(std::string_view file, int line, T *h_ptr, std::size_t len=1)
Definition: offload.hpp:132
int nrn_set_timeout(int timeout)
Definition: netpar.cpp:598
void update_nrnthreads_on_host(NrnThread *threads, int nthreads)
void update(NrnThread *_nt)
T * cnrn_target_copyin(std::string_view file, int line, const T *h_ptr, std::size_t len=1)
Definition: offload.hpp:110
bool use_multisend_
Definition: multisend.cpp:53
void report_mem_usage(const char *message, bool all_ranks)
Reports current memory usage of the simulator to stdout.
void nrn_fixed_step_minimal()
int n_multisend_interval
Definition: multisend.cpp:55
int interleave_permute_type
bool use_solve_interleave
Definition: solve_core.cpp:13
void set_globals(const char *path, bool cli_global_seed, int cli_global_seed_value)
Definition: global_vars.cpp:43
void BBS_netpar_solve(double tstop)
Definition: netpar.cpp:604
double celsius
void delete_trajectory_requests(NrnThread &nt)
Definition: nrn_setup.cpp:905
const char * bbcore_write_version
Definition: nrnoc_aux.cpp:24
void call_prcellstate_for_prcellgid(int prcellgid, int compute_gpu, int is_init)
Definition: main1.cpp:343
std::unique_ptr< ReportHandler > create_report_handler(const ReportConfiguration &config, const SpikesInfo &spikes_info)
Definition: main1.cpp:399
static void mk_mech()
Definition: mk_mech.cpp:68
void set_report_buffer_size(int n)
Definition: nrnreport.cpp:58
void mk_spikevec_buffer(int sz)
nrn_pragma_acc(routine seq) int vector_capacity(void *v)
Definition: ivocvect.cpp:30
void nrnran123_destroy_global_state_on_device()
Definition: nrnran123.cpp:158
std::vector< ReportConfiguration > create_report_configurations(const std::string &filename, const std::string &output_dir, SpikesInfo &spikes_info)
mpi_manager_t & mpi_manager()
Definition: nrnmpi.h:52
void finalize_report()
Definition: nrnreport.cpp:65
void delete_nrnthreads_on_device(NrnThread *threads, int nthreads)
Cleanup device memory that is being tracked by the OpenACC runtime.
void init_gpu()
void setup_report_engine(double dt_report, double mindelay)
in the current implementation, we call flush during every spike exchange interval.
Definition: nrnreport.cpp:47
void dt2thread(double adt)
void nrnran123_initialise_global_state_on_device()
Definition: nrnran123.cpp:150
void setup_nrnthreads_on_device(NrnThread *threads, int nthreads)
void allocate_data_in_mechanism_nrn_init()
Definition: finitialize.cpp:21
void output_spikes(const char *outpath, const SpikesInfo &spikes_info)
double * legacy_index2pointer(int mtype, int index, NrnThread &nt)
Definition: nrn_setup.cpp:643
void direct_mode_initialize()
All state from NEURON necessary to continue a run.
void clear_spike_vectors()
std::string cnrn_version()
Definition: main1.cpp:382
corenrn_parameters corenrn_param
Printing method.
void update_weights_from_gpu(NrnThread *threads, int nthreads)
Copy weights from GPU to CPU.
void nrn_mkPatternStim(const char *fname, double tstop)
Definition: patternstim.cpp:60
int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_meth)
Definition: netpar.cpp:753
handle_interface< non_owning_identifier< storage > > handle
Non-owning handle to a Mechanism instance.
std::string to_string(const T &obj)
void(* nrn2core_all_weights_return_)(std::vector< double * > &weights)
Definition: nrn_setup.cpp:75
void(* nrn2core_get_trajectory_requests_)(int tid, int &bsize, int &n_pr, void **&vpr, int &n_trajec, int *&types, int *&indices, double **&pvars, double **&varrays)
Definition: nrn_setup.cpp:59
bool corenrn_embedded
--> Coreneuron
Definition: nrn_setup.cpp:47
void(* nrn2core_trajectory_return_)(int tid, int n_pr, int bsize, int vecsz, void **vpr, double t)
Definition: nrn_setup.cpp:71
Function declarations for the cell statistics.
size_t p
void nrnmpi_init(int nrnmpi_under_nrncontrol, int *pargc, char ***pargv)
Definition: nrnmpi.cpp:55
TrajectoryRequests * trajec_requests
Definition: multicore.hpp:146
bool threading
Use Multisend spike exchange instead of Allgather.
double mindelay
Forward skip to TIME.
std::string restorepath
Name of file containing list of gids dat files read in.
double voltage
Temperature in degC.
std::string reportfilepath
Restore simulation from provided checkpoint directory.
std::string filesdat
Directory where spikes will be written.
int seed
Size in MB of the report buffer.
std::string outpath
Directory path where .dat files.
bool binqueue
Enable CUDA interface (default is the OpenACC interface).
unsigned ms_subint
Number of multisend phases, 1 or 2.
double forwardskip
Initial voltage used for nrn_finitialize(1, v_init).
unsigned cell_interleave_permute
Spike Compression.
bool cuda_interface
Enable GPU computation.
int prcellgid
Internal buffer used on every rank for spikes.
bool mpi_enable
Initialization seed for random number generator (int)
std::string datpath
Apply patternstim using the specified spike file.
unsigned nwarp
Cell interleaving permutation.
bool multisend
Skip MPI finalization.
unsigned spkcompress
Number of multisend interval. 1 or 2.
double dt
Stop time of simulation in msec.
std::string patternstim
Maximum integration interval (likely reduced by minimum NetCon delay).
unsigned report_buff_size
Number of gpus to use per node.
unsigned ms_phases
Gid of cell for prcellstate.
double celsius
I/O timestep to use in msec for reports.
std::string mpi_lib
Write parameters to this file.
std::string writeParametersFilepath
Enable checkpoint and specify directory to store related files.
std::string checkpointpath
Reports configuration file.
static constexpr char const * default_dat_filename
void parse(int argc, char *argv[])
Destructor defined in .cpp where CLI11 types are complete.
std::string config_to_str(bool default_also=false, bool write_description=false) const
Return a string summarising the current parameter values.
void reset()
Runs the CLI11_PARSE macro.
void resolve_symbols(void *dlsym_handle)
Definition: resolve.cpp:7
static std::string to_string()
return version string (version + git id) as a string
Definition: config.h:34