NEURON
enginemech.cpp File Reference

Provides interface function for CoreNEURON mechanism library and NEURON. More...

#include <cstdlib>
#include <coreneuron/engine.h>
#include <string>
#include <iostream>

Go to the source code of this file.

Namespaces

 coreneuron
 THIS FILE IS AUTO GENERATED DONT MODIFY IT.
 

Functions

void coreneuron::modl_reg ()
 Mechanism registration function. More...
 
void coreneuron::nrn_cleanup_ion_map ()
 Cleanup global ion map created during mechanism registration. More...
 
char * prepare_args (int &argc, char **&argv, std::string &args)
 parse arguments from neuron and prepare new one for coreneuron More...
 
void mk_mech_init (int argc, char **argv)
 initialize standard mechanisms from coreneuron More...
 
void set_openmp_threads (int nthread)
 set openmp threads equal to neuron's pthread More...
 
void add_mpi_library_arg (const char *mpi_lib, std::string &args)
 Add MPI library loading CLI argument for CoreNEURON. More...
 
int corenrn_embedded_run (int nthread, int have_gaps, int use_mpi, int use_fast_imem, const char *mpi_lib, const char *nrn_arg, int file_mode)
 Run CoreNEURON in embedded mode with NEURON. More...
 
int solve_core (int argc, char **argv)
 Initialize mechanisms and run simulation using CoreNEURON. More...
 

Variables

bool coreneuron::nrn_have_gaps
 variables defined in coreneuron library More...
 
bool coreneuron::nrn_use_fast_imem
 
bool corenrn_embedded
 global variables from coreneuron library More...
 
bool corenrn_file_mode
 
int corenrn_embedded_nthread
 

Detailed Description

Provides interface function for CoreNEURON mechanism library and NEURON.

libcorenrnmech is a interface library provided to building standalone executable special-core. Also, it is used by NEURON to run CoreNEURON via dlopen to execute models via in-memory transfer.

Definition in file enginemech.cpp.

Function Documentation

◆ add_mpi_library_arg()

void add_mpi_library_arg ( const char *  mpi_lib,
std::string &  args 
)

Add MPI library loading CLI argument for CoreNEURON.

CoreNEURON requires --mpi-lib CLI argument with the path of library. In case of solve_core() call from MOD file, such CLI argument may not present. In this case, we additionally check NRN_CORENRN_MPI_LIB env variable set by NEURON.

Parameters
mpi_libpath of coreneuron MPI library to load
argschar* argv[] in std::string form

Definition at line 72 of file enginemech.cpp.

◆ corenrn_embedded_run()

int corenrn_embedded_run ( int  nthread,
int  have_gaps,
int  use_mpi,
int  use_fast_imem,
const char *  mpi_lib,
const char *  nrn_arg,
int  file_mode 
)

Run CoreNEURON in embedded mode with NEURON.

Parameters
nthreadNumber of Pthreads on NEURON side
have_gapsTrue if gap junctions are used
use_mpiTrue if MPI is used on NEURON side
use_fast_imemTrue if fast imembrance calculation enabled
nrn_argCommand line arguments passed by NEURON
Returns
1 if embedded mode is used otherwise 0
Todo:
Change return type semantics

Definition at line 106 of file enginemech.cpp.

◆ mk_mech_init()

void mk_mech_init ( int  argc,
char **  argv 
)

initialize standard mechanisms from coreneuron

Definition at line 438 of file main1.cpp.

◆ prepare_args()

char* prepare_args ( int &  argc,
char **&  argv,
std::string &  args 
)

parse arguments from neuron and prepare new one for coreneuron

parse arguments from neuron and prepare new one for coreneuron

Definition at line 77 of file main1.cpp.

◆ set_openmp_threads()

void set_openmp_threads ( int  nthread)

set openmp threads equal to neuron's pthread

set openmp threads equal to neuron's pthread

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.

Definition at line 65 of file main1.cpp.

◆ solve_core()

int solve_core ( int  argc,
char **  argv 
)

Initialize mechanisms and run simulation using CoreNEURON.

NOTE: this type of usage via MOD file exist in neurodamus where we delete entire model and call coreneuron via file mode.

Definition at line 179 of file enginemech.cpp.

Variable Documentation

◆ corenrn_embedded

bool corenrn_embedded
extern

global variables from coreneuron library

global variables from coreneuron library

Definition at line 47 of file nrn_setup.cpp.

◆ corenrn_embedded_nthread

int corenrn_embedded_nthread
extern

Definition at line 49 of file nrn_setup.cpp.

◆ corenrn_file_mode

bool corenrn_file_mode
extern

Definition at line 48 of file nrn_setup.cpp.