Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 7ff03a4

Browse files
Add --verbose option Closes #338 (#341)
* Add verbose option * Disable brew update to speedup builds * Use Xcode 11.3 for travis OSX CI
1 parent f2e0f01 commit 7ff03a4

File tree

9 files changed

+59
-26
lines changed

9 files changed

+59
-26
lines changed

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ matrix:
3535
- PYTHON_VERSION=3.6.7 # for nmodl pip3 install
3636
- USE_NMODL=ON
3737
- os: osx
38-
osx_image: xcode10.2
38+
osx_image: xcode11.3
3939
env:
4040
- cmake_option="-DCORENRN_ENABLE_MPI=ON"
4141
- os: osx
42-
osx_image: xcode10.2
42+
osx_image: xcode11.3
4343
env:
4444
- cmake_option="-DCORENRN_ENABLE_MPI=OFF"
4545
- os: osx
46-
osx_image: xcode10.2
46+
osx_image: xcode11.3
4747
env:
4848
- cmake_option="-DCORENRN_ENABLE_SOA=ON"
4949
- os: osx
50-
osx_image: xcode10.2
50+
osx_image: xcode11.3
5151
env:
5252
- cmake_option="-DCORENRN_ENABLE_SOA=OFF"
5353
- os: osx
54-
osx_image: xcode10.2
54+
osx_image: xcode11.3
5555
env:
5656
- USE_NMODL=ON
5757
- os: linux
@@ -100,7 +100,6 @@ addons:
100100
- openmpi
101101
- boost
102102
- python@3
103-
update: true
104103

105104
#=============================================================================
106105
# Set up environments

coreneuron/apps/corenrn_parameters.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ corenrn_parameters::corenrn_parameters(){
4242
app.add_option("-e, --tstop", this->tstop, "Stop Time in ms.")
4343
->check(CLI::Range(0., 1e9));
4444
app.add_flag("--show");
45+
app.add_set("--verbose", this->verbose, {verbose_level::NONE, verbose_level::ERROR, verbose_level::INFO, verbose_level::DEBUG}, "Verbose level: 0 = NONE, 1 = ERROR, 2 = INFO, 3 = DEBUG. Default is INFO");
4546

4647
auto sub_gpu = app.add_option_group("GPU", "Commands relative to GPU.");
4748
sub_gpu -> add_option("-W, --nwarp", this->nwarp, "Number of warps to balance.", true)
@@ -110,6 +111,9 @@ void corenrn_parameters::parse (int argc, char** argv) {
110111

111112
try {
112113
app.parse(argc, argv);
114+
if(verbose == verbose_level::NONE) {
115+
nrn_nobanner_ = 1;
116+
}
113117
} catch (const CLI::ExtrasError &e) {
114118
std::cerr << "Single-dash arguments such as -mpi are deleted, please check ./coreneuron_exec --help for more information. \n" << std::endl;
115119
app.exit(e);
@@ -171,7 +175,7 @@ std::ostream& operator<<(std::ostream& os, const corenrn_parameters& corenrn_par
171175
return os;
172176
}
173177

174-
175178
corenrn_parameters corenrn_param;
179+
int nrn_nobanner_{0};
176180

177181
} // namespace coreneuron

coreneuron/apps/corenrn_parameters.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ namespace coreneuron {
5757

5858
struct corenrn_parameters {
5959

60+
enum verbose_level : std::uint32_t
61+
{
62+
NONE = 0,
63+
ERROR = 1,
64+
INFO = 2,
65+
DEBUG = 3,
66+
DEFAULT = INFO
67+
};
68+
6069
const int report_buff_size_default=4;
6170

6271
unsigned spikebuf=100'000; /// Internal buffer used on every rank for spikes
@@ -78,6 +87,8 @@ struct corenrn_parameters {
7887
bool gpu=false; /// Enable GPU computation.
7988
bool binqueue=false; /// Use bin queue.
8089

90+
verbose_level verbose{verbose_level::DEFAULT}; /// Verbosity-level
91+
8192
double tstop=100; /// Stop time of simulation in msec
8293
double dt=-1000.0; /// Timestep to use in msec
8394
double dt_io=0.1; /// I/O timestep to use in msec
@@ -102,11 +113,14 @@ struct corenrn_parameters {
102113

103114
void parse(int argc, char* argv[]); /// Runs the CLI11_PARSE macro.
104115

116+
inline bool is_quiet() { return verbose == verbose_level::NONE; }
117+
105118
};
106119

107120
std::ostream& operator<<(std::ostream& os, const corenrn_parameters& corenrn_param); /// Printing method.
108121

109122
extern corenrn_parameters corenrn_param; /// Declaring global corenrn_parameters object for this instance of CoreNeuron.
123+
extern int nrn_nobanner_; /// Global no banner setting
110124

111125
} // namespace coreneuron
112126

coreneuron/apps/main1.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ void nrn_init_and_load_data(int argc,
147147
Instrumentor::stop_profile();
148148

149149
// memory footprint after mpi initialisation
150-
report_mem_usage("After MPI_Init");
150+
if (!corenrn_param.is_quiet()) {
151+
report_mem_usage("After MPI_Init");
152+
}
151153

152154
// initialise default coreneuron parameters
153155
initnrn();
@@ -216,7 +218,9 @@ void nrn_init_and_load_data(int argc,
216218
nrn_set_extra_thread0_vdata();
217219
}
218220

219-
report_mem_usage("Before nrn_setup");
221+
if (!corenrn_param.is_quiet()) {
222+
report_mem_usage("Before nrn_setup");
223+
}
220224

221225
// set if need to interleave cells
222226
interleave_permute_type = corenrn_param.cell_interleave_permute;
@@ -255,7 +259,9 @@ void nrn_init_and_load_data(int argc,
255259
int spkcompress = corenrn_param.spkcompress;
256260
nrnmpi_spike_compress(spkcompress, (spkcompress ? true : false), use_multisend_);
257261

258-
report_mem_usage("After nrn_setup ");
262+
if (!corenrn_param.is_quiet()) {
263+
report_mem_usage("After nrn_setup ");
264+
}
259265

260266
// Invoke PatternStim
261267
if (!corenrn_param.patternstim.empty()) {
@@ -266,15 +272,17 @@ void nrn_init_and_load_data(int argc,
266272
nrn_set_timeout(200.);
267273

268274
// show all configuration parameters for current run
269-
if (nrnmpi_myid == 0) {
275+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
270276
std::cout << corenrn_param << std::endl;
271277
std::cout << " Start time (t) = " << t << std::endl << std::endl;
272278
}
273279

274280
// allocate buffer for mpi communication
275281
mk_spikevec_buffer(corenrn_param.spikebuf);
276282

277-
report_mem_usage("After mk_spikevec_buffer");
283+
if (!corenrn_param.is_quiet()) {
284+
report_mem_usage("After mk_spikevec_buffer");
285+
}
278286

279287
if (corenrn_param.gpu) {
280288
setup_nrnthreads_on_device(nrn_threads, nrn_nthread);
@@ -460,7 +468,9 @@ extern "C" int run_solve_core(int argc, char** argv) {
460468
std::string spikes_population_name;
461469
bool reports_needs_finalize = false;
462470

463-
report_mem_usage("After mk_mech");
471+
if (!corenrn_param.is_quiet()) {
472+
report_mem_usage("After mk_mech");
473+
}
464474

465475
// Create outpath if it does not exist
466476
if (nrnmpi_myid == 0) {
@@ -534,7 +544,9 @@ extern "C" int run_solve_core(int argc, char** argv) {
534544
nrn_finitialize(v != 1000., v);
535545
}
536546

537-
report_mem_usage("After nrn_finitialize");
547+
if (!corenrn_param.is_quiet()) {
548+
report_mem_usage("After nrn_finitialize");
549+
}
538550

539551
// register all reports into reportinglib
540552
double min_report_dt = INT_MAX;

coreneuron/io/mk_mech.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ THE POSSIBILITY OF SUCH DAMAGE.
4343
#include "coreneuron/coreneuron.hpp"
4444
#include "coreneuron/mechanism//eion.hpp"
4545

46-
static char banner[] = "Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019";
46+
static char banner[] = "Duke, Yale, and the BlueBrain Project -- Copyright 1984-2020";
4747

4848
namespace coreneuron {
49-
int nrn_nobanner_;
49+
extern int nrn_nobanner_;
5050

5151
// NB: this should go away
5252
extern const char* nrn_version(int);

coreneuron/io/nrn_setup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3131
#include <map>
3232
#include <cstring>
3333

34+
#include "coreneuron/apps/corenrn_parameters.hpp"
3435
#include "coreneuron/nrnconf.h"
3536
#include "coreneuron/utils/randoms/nrnran123.h"
3637
#include "coreneuron/sim/multicore.hpp"
@@ -217,6 +218,7 @@ int (*nrn2core_all_spike_vectors_return_)(std::vector<double>& spikevec, std::ve
217218
// files with the first containing output_gids and netcon_srcgid which are
218219
// stored in the nt.presyns array and nt.netcons array respectively
219220
namespace coreneuron {
221+
extern corenrn_parameters corenrn_param;
220222
int nrn_setup_multiple = 1; /* default */
221223
int nrn_setup_extracon = 0; /* default */
222224
static int maxgid;
@@ -805,7 +807,7 @@ void nrn_setup(const char* filesdat,
805807
delete[] gidgroups;
806808
delete[] imult;
807809

808-
if (nrnmpi_myid == 0) {
810+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
809811
printf(" Setup Done : %.2lf seconds \n", nrn_wtime() - time);
810812
}
811813
}

coreneuron/network/netpar.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3232
#include <map>
3333

3434
#include "coreneuron/nrnconf.h"
35+
#include "coreneuron/apps/corenrn_parameters.hpp"
3536
#include "coreneuron/sim/multicore.hpp"
3637
#include "coreneuron/mpi/nrnmpi.h"
3738
#include "coreneuron/mpi/nrnmpidec.h"
@@ -50,6 +51,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
5051

5152
namespace coreneuron {
5253

54+
extern corenrn_parameters corenrn_param;
5355
class PreSyn;
5456
class InputPreSyn;
5557

@@ -728,7 +730,7 @@ void BBS_netpar_solve(double tstop) {
728730
#endif
729731
tstopunset;
730732

731-
if (nrnmpi_myid == 0) {
733+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
732734
printf("\nSolver Time : %g\n", nrn_wtime() - time);
733735
}
734736
}

coreneuron/sim/fadvance_core.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3030

3131
#include "coreneuron/coreneuron.hpp"
3232
#include "coreneuron/nrnconf.h"
33+
#include "coreneuron/apps/corenrn_parameters.hpp"
3334
#include "coreneuron/sim/multicore.hpp"
3435
#include "coreneuron/mpi/nrnmpi.h"
3536
#include "coreneuron/sim/fast_imem.hpp"
@@ -45,6 +46,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
4546

4647
namespace coreneuron {
4748

49+
extern corenrn_parameters corenrn_param;
4850
static void* nrn_fixed_step_thread(NrnThread*);
4951
static void* nrn_fixed_step_group_thread(NrnThread*, int, int, int&);
5052

@@ -94,20 +96,20 @@ integration interval before joining
9496
static progressbar* progress;
9597

9698
void initialize_progress_bar(int nstep) {
97-
if (nrnmpi_myid == 0) {
99+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
98100
printf("\n");
99101
progress = progressbar_new(" psolve", nstep);
100102
}
101103
}
102104

103105
void update_progress_bar(int step, double time) {
104-
if (nrnmpi_myid == 0) {
106+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
105107
progressbar_update(progress, step, time);
106108
}
107109
}
108110

109111
void finalize_progress_bar() {
110-
if (nrnmpi_myid == 0) {
112+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
111113
progressbar_finish(progress);
112114
}
113115
}

coreneuron/utils/nrn_stats.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3636
#include <cstdio>
3737
#include <climits>
3838
#include <vector>
39+
#include "coreneuron/apps/corenrn_parameters.hpp"
3940
#include "coreneuron/utils/nrn_stats.h"
4041
#include "coreneuron/mpi/nrnmpi.h"
4142
#include "coreneuron/sim/multicore.hpp"
@@ -44,6 +45,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
4445
#include "coreneuron/io/output_spikes.hpp"
4546
namespace coreneuron {
4647
extern NetCvode* net_cvode_instance;
48+
extern corenrn_parameters corenrn_param;
4749

4850
const int NUM_STATS = 12;
4951
#if COLLECT_TQueue_STATISTICS
@@ -155,7 +157,7 @@ void report_cell_stats(void) {
155157
memcpy(gstat_array, stat_array, sizeof(stat_array));
156158
#endif
157159

158-
if (nrnmpi_myid == 0) {
160+
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
159161
printf("\n\n Simulation Statistics\n");
160162
printf(" Number of cells: %ld\n", gstat_array[0]);
161163
printf(" Number of compartments: %ld\n", gstat_array[10]);
@@ -209,9 +211,5 @@ void report_cell_stats(void) {
209211
nrnmpi_barrier();
210212
}
211213
#endif
212-
if (nrnmpi_myid == 0) {
213-
printf("\n\n");
214-
fflush(stdout);
215-
}
216214
}
217215
} // namespace coreneuron

0 commit comments

Comments
 (0)