10 #include <CLI/CLI.hpp>
17 : m_app{std::make_unique<
CLI::App>(
"CoreNeuron - Optimised Simulator Engine for NEURON.")} {
19 app.set_config(
"--read-config",
"",
"Read parameters from ini file",
false)
20 ->check(CLI::ExistingFile);
21 app.add_option(
"--write-config",
23 "Write parameters to this file");
28 "Enable MPI. In order to initialize MPI environment this argument must be specified.");
29 app.add_option(
"--mpi-lib",
31 "CoreNEURON MPI library to load for dynamic MPI support");
32 app.add_flag(
"--gpu", this->
gpu,
"Activate GPU computation.");
33 app.add_option(
"--dt",
35 "Fixed time step. The default value is set by defaults.dat or is 0.025.")
36 ->capture_default_str()
37 ->check(CLI::Range(-1'000., 1e9));
38 app.add_option(
"-e, --tstop", this->
tstop,
"Stop Time in ms.")->check(CLI::Range(0., 1e9));
39 app.add_flag(
"--show");
40 app.add_option(
"--verbose",
42 "Verbose level: 0 = NONE, 1 = ERROR, 2 = INFO, 3 = DEBUG. Default is INFO")
43 ->check(CLI::IsMember({verbose_level::NONE,
46 verbose_level::DEBUG_INFO}));
47 app.add_flag(
"--model-stats",
49 "Print number of instances of each mechanism and detailed memory stats.");
51 auto sub_gpu = app.add_option_group(
"GPU",
"Commands relative to GPU.");
53 ->add_option(
"-W, --nwarp",
55 "Number of warps to execute in parallel the Hines solver. Each warp solves a "
56 "group of cells. (Only used with cell permute 2)")
57 ->capture_default_str()
58 ->check(CLI::Range(0, 1'000'000));
60 ->add_option(
"-R, --cell-permute",
62 "Cell permutation: 0 No permutation; 1 optimise node adjacency; 2 optimize "
64 ->capture_default_str()
65 ->check(CLI::Range(0, 2));
66 sub_gpu->add_flag(
"--cuda-interface",
68 "Activate CUDA branch of the code.");
69 sub_gpu->add_option(
"-n, --num-gpus", this->
num_gpus,
"Number of gpus to use per node.");
71 auto sub_input = app.add_option_group(
"input",
"Input dataset options.");
72 sub_input->add_option(
"-d, --datpath", this->
datpath,
"Path containing CoreNeuron data files.")
73 ->check(CLI::ExistingDirectory);
74 sub_input->add_option(
"-f, --filesdat", this->
filesdat,
"Name for the distribution file.")
75 ->capture_default_str()
76 ->check(CLI::ExistingFile);
78 ->add_option(
"-p, --pattern",
80 "Apply patternstim using the specified spike file.")
81 ->check(CLI::ExistingFile);
83 ->add_option(
"-s, --seed", this->
seed,
"Initialization seed for random number generator.")
84 ->check(CLI::Range(0, 100'000'000));
86 ->add_option(
"-v, --voltage",
88 "Initial voltage used for nrn_finitialize(1, v_init). If 1000, then "
89 "nrn_finitialize(0,...).")
90 ->check(CLI::Range(-1e9, 1e9));
91 sub_input->add_option(
"--report-conf", this->
reportfilepath,
"Reports configuration file.")
92 ->check(CLI::ExistingFile);
94 ->add_option(
"--restore",
96 "Restore simulation from provided checkpoint directory.")
97 ->check(CLI::ExistingDirectory);
99 auto sub_parallel = app.add_option_group(
"parallel",
"Parallel processing options.");
100 sub_parallel->add_flag(
"-c, --threading",
102 "Parallel threads. The default is serial threads.");
103 sub_parallel->add_flag(
"--skip-mpi-finalize",
105 "Do not call mpi finalize.");
107 auto sub_spike = app.add_option_group(
"spike",
"Spike exchange options.");
108 sub_spike->add_option(
"--ms-phases", this->
ms_phases,
"Number of multisend phases, 1 or 2.")
109 ->capture_default_str()
110 ->check(CLI::Range(1, 2));
112 ->add_option(
"--ms-subintervals",
114 "Number of multisend subintervals, 1 or 2.")
115 ->capture_default_str()
116 ->check(CLI::Range(1, 2));
117 sub_spike->add_flag(
"--multisend",
119 "Use Multisend spike exchange instead of Allgather.");
121 ->add_option(
"--spkcompress",
123 "Spike compression. Up to ARG are exchanged during MPI_Allgather.")
124 ->capture_default_str()
125 ->check(CLI::Range(0, 100'000));
126 sub_spike->add_flag(
"--binqueue", this->
binqueue,
"Use bin queue.");
128 auto sub_config = app.add_option_group(
"config",
"Config options.");
129 sub_config->add_option(
"-b, --spikebuf", this->
spikebuf,
"Spike buffer size.")
130 ->capture_default_str()
131 ->check(CLI::Range(0, 2'000'000'000));
133 ->add_option(
"-g, --prcellgid",
135 "Output prcellstate information for the gid NUMBER.")
136 ->check(CLI::Range(-1, 2'000'000'000));
137 sub_config->add_option(
"-k, --forwardskip", this->
forwardskip,
"Forwardskip to TIME")
138 ->check(CLI::Range(0., 1e9));
143 "Temperature in degC. The default value is set in defaults.dat or else is 34.0.")
144 ->capture_default_str()
145 ->check(CLI::Range(-1000., 1000.));
147 ->add_option(
"--mindelay",
149 "Maximum integration interval (likely reduced by minimum NetCon delay).")
150 ->capture_default_str()
151 ->check(CLI::Range(0., 1e9));
153 ->add_option(
"--report-buffer-size",
155 "Size in MB of the report buffer.")
156 ->check(CLI::Range(1, 128));
158 auto sub_output = app.add_option_group(
"output",
"Output configuration.");
159 sub_output->add_option(
"-i, --dt_io", this->
dt_io,
"Dt of I/O.")
160 ->capture_default_str()
161 ->check(CLI::Range(-1000., 1e9));
162 sub_output->add_option(
"-o, --outpath", this->
outpath,
"Path to place output data files.")
163 ->capture_default_str();
164 sub_output->add_option(
"--checkpoint",
166 "Enable checkpoint and specify directory to store related files.");
168 app.add_flag(
"-v, --version", this->
show_version,
"Show version information and quit.");
170 CLI::retire_option(app,
"--show");
177 return m_app->config_to_str(default_also, write_description);
188 if (
verbose == verbose_level::NONE) {
191 }
catch (
const CLI::ExtrasError& e) {
193 std::cerr <<
"CLI parsing error, see nrniv-core --help for more information. \n"
197 }
catch (
const CLI::ParseError& e) {
203 #ifndef CORENEURON_ENABLE_GPU
206 <<
"Error: GPU support was not enabled at build time but GPU execution was requested."
214 std::cout <<
"CoreNEURON Version : " <<
cnrn_version() << std::endl;
220 os <<
"GENERAL PARAMETERS" << std::endl
227 <<
"GPU" << std::endl
232 <<
"INPUT PARAMETERS" << std::endl
241 <<
"PARALLEL COMPUTATION PARAMETERS" << std::endl
246 <<
"SPIKE EXCHANGE" << std::endl
253 <<
"CONFIGURATION" << std::endl
261 <<
"OUTPUT PARAMETERS" << std::endl
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
int nrn_nobanner_
Declaring global corenrn_parameters object for this instance of CoreNeuron.
std::string cnrn_version()
corenrn_parameters corenrn_param
Printing method.
std::ostream & operator<<(std::ostream &os, const corenrn_parameters &corenrn_param)
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.
bool show_version
Use bin queue.
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.
bool model_stats
Print version and exit.
double forwardskip
Initial voltage used for nrn_finitialize(1, v_init).
unsigned cell_interleave_permute
Spike Compression.
verbose_level verbose
Print mechanism counts and model size after initialization.
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.
double tstop
Verbosity-level.
bool gpu
Enable pthread/openmp.
std::string patternstim
Maximum integration interval (likely reduced by minimum NetCon delay).
unsigned report_buff_size
Number of gpus to use per node.
double dt_io
Timestep to use in msec.
unsigned ms_phases
Gid of cell for prcellstate.
unsigned num_gpus
Number of warps to balance for cell_interleave_permute == 2.
bool skip_mpi_finalize
Enable MPI flag.
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.
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.
~corenrn_parameters()
Constructor that initializes the CLI11 app.
void reset()
Runs the CLI11_PARSE macro.
std::unique_ptr< CLI::App > m_app