NEURON
nrnmain.cpp
Go to the documentation of this file.
1
#include "
nrnconf.h
"
2
#include "nrnmpi.h"
3
#include "../nrncvode/nrnneosm.h"
4
5
#include <errno.h>
6
#include <stdio.h>
7
#include <string.h>
8
9
extern
int
ivocmain
(
int
,
const
char
**,
const
char
**);
10
extern
int
nrn_main_launch
;
11
extern
int
nrn_noauto_dlopen_nrnmech
;
12
#if NRNMPI_DYNAMICLOAD
13
void
nrnmpi_stubs();
14
void
nrnmpi_load_or_exit();
15
#if NRN_MUSIC
16
void
nrnmusic_load
();
17
#endif
// NRN_MUSIC
18
#endif
// NRNMPI_DYNAMICLOAD
19
#if NRNMPI
20
extern
"C"
void
nrnmpi_init
(
int
nrnmpi_under_nrncontrol,
int
* pargc,
char
*** pargv);
21
#endif
22
23
int
main
(
int
argc
,
char
**
argv
,
char
**
env
) {
24
nrn_main_launch
= 1;
25
26
#if defined(AUTO_DLOPEN_NRNMECH) && AUTO_DLOPEN_NRNMECH == 0
27
nrn_noauto_dlopen_nrnmech
= 1;
28
#endif
29
30
#if NRNMPI
31
#if NRNMPI_DYNAMICLOAD
32
nrnmpi_stubs();
33
bool
mpi_loaded =
false
;
34
for
(
int
i
= 0;
i
<
argc
; ++
i
) {
35
if
(strcmp(
"-mpi"
,
argv
[
i
]) == 0) {
36
nrnmpi_load_or_exit();
37
mpi_loaded =
true
;
38
break
;
39
}
40
}
41
#if NRN_MUSIC
42
// There are three ways that a future call to nrnmusic_init sets
43
// nrnmusic = 1. 1) arg0 ends with "music", 2) there is a -music arg,
44
// 3) there is a _MUSIC_CONFIG_ environment variable. Use those here to
45
// decide whether to call nrnmusic_load() (which exits if it does not
46
// succeed.)
47
bool
load_music
=
false
;
48
if
(strlen(
argv
[0]) >= 5 && strcmp(
argv
[0] + strlen(
argv
[0]) - 5,
"music"
) == 0) {
49
load_music
=
true
;
50
}
51
for
(
int
i
= 0;
i
<
argc
; ++
i
) {
52
if
(strcmp(
"-music"
,
argv
[
i
]) == 0) {
53
load_music
=
true
;
54
break
;
55
}
56
}
57
if
(getenv(
"_MUSIC_CONFIG_"
)) {
58
load_music
=
true
;
59
}
60
if
(
load_music
) {
61
if
(!mpi_loaded) {
62
nrnmpi_load_or_exit();
63
}
64
nrnmusic_load
();
65
}
66
#endif
// NRNMUSIC
67
#endif
// NRNMPI_DYNAMICLOAD
68
nrnmpi_init
(1, &
argc
, &
argv
);
// may change argc and argv
69
#endif
// NRNMPI
70
errno = 0;
71
return
ivocmain
(
argc
, (
const
char
**)
argv
, (
const
char
**)
env
);
72
}
73
74
#if USENCS
75
void
nrn2ncs_outputevent
(
int
,
double
) {}
76
#endif
i
#define i
Definition:
md1redef.h:19
env
static char * env[]
Definition:
inithoc.cpp:259
argc
static int argc
Definition:
inithoc.cpp:45
argv
static char ** argv
Definition:
inithoc.cpp:46
coreneuron::nrn2ncs_outputevent
void nrn2ncs_outputevent(int netcon_output_index, double firetime)
nrnconf.h
main
int main(int argc, char **argv, char **env)
Definition:
nrnmain.cpp:23
nrn_main_launch
int nrn_main_launch
Definition:
hoc_init.cpp:333
ivocmain
int ivocmain(int, const char **, const char **)
Main entrypoint function into the HOC interpeter.
Definition:
ivocmain.cpp:334
nrn_noauto_dlopen_nrnmech
int nrn_noauto_dlopen_nrnmech
Definition:
hoc_init.cpp:229
nrnmpi_init
void nrnmpi_init(int nrnmpi_under_nrncontrol, int *pargc, char ***pargv)
Definition:
nrnmpi.cpp:55
load_music
static void load_music()
Definition:
nrnmusic_dynam.cpp:23
nrnmusic_load
void nrnmusic_load()
Definition:
nrnmusic_dynam.cpp:40
src
ivoc
nrnmain.cpp