Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ matrix:
- PYTHON_VERSION=3.6.7 # for nmodl pip3 install
- USE_NMODL=ON
- os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- cmake_option="-DCORENRN_ENABLE_MPI=ON"
- os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- cmake_option="-DCORENRN_ENABLE_MPI=OFF"
- os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- cmake_option="-DCORENRN_ENABLE_SOA=ON"
- os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- cmake_option="-DCORENRN_ENABLE_SOA=OFF"
- os: osx
osx_image: xcode10.2
osx_image: xcode11.3
env:
- USE_NMODL=ON
- os: linux
Expand Down Expand Up @@ -100,7 +100,6 @@ addons:
- openmpi
- boost
- python@3
update: true

#=============================================================================
# Set up environments
Expand Down
6 changes: 5 additions & 1 deletion coreneuron/apps/corenrn_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ corenrn_parameters::corenrn_parameters(){
app.add_option("-e, --tstop", this->tstop, "Stop Time in ms.")
->check(CLI::Range(0., 1e9));
app.add_flag("--show");
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");

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

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


corenrn_parameters corenrn_param;
int nrn_nobanner_{0};

} // namespace coreneuron
14 changes: 14 additions & 0 deletions coreneuron/apps/corenrn_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ namespace coreneuron {

struct corenrn_parameters {

enum verbose_level : std::uint32_t
{
NONE = 0,
ERROR = 1,
INFO = 2,
DEBUG = 3,
DEFAULT = INFO
};

const int report_buff_size_default=4;

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

verbose_level verbose{verbose_level::DEFAULT}; /// Verbosity-level

double tstop=100; /// Stop time of simulation in msec
double dt=-1000.0; /// Timestep to use in msec
double dt_io=0.1; /// I/O timestep to use in msec
Expand All @@ -102,11 +113,14 @@ struct corenrn_parameters {

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

inline bool is_quiet() { return verbose == verbose_level::NONE; }

};

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

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

} // namespace coreneuron

Expand Down
26 changes: 19 additions & 7 deletions coreneuron/apps/main1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ void nrn_init_and_load_data(int argc,
Instrumentor::stop_profile();

// memory footprint after mpi initialisation
report_mem_usage("After MPI_Init");
if (!corenrn_param.is_quiet()) {
report_mem_usage("After MPI_Init");
}

// initialise default coreneuron parameters
initnrn();
Expand Down Expand Up @@ -216,7 +218,9 @@ void nrn_init_and_load_data(int argc,
nrn_set_extra_thread0_vdata();
}

report_mem_usage("Before nrn_setup");
if (!corenrn_param.is_quiet()) {
report_mem_usage("Before nrn_setup");
}

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

report_mem_usage("After nrn_setup ");
if (!corenrn_param.is_quiet()) {
report_mem_usage("After nrn_setup ");
}

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

// show all configuration parameters for current run
if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
std::cout << corenrn_param << std::endl;
std::cout << " Start time (t) = " << t << std::endl << std::endl;
}

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

report_mem_usage("After mk_spikevec_buffer");
if (!corenrn_param.is_quiet()) {
report_mem_usage("After mk_spikevec_buffer");
}

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

report_mem_usage("After mk_mech");
if (!corenrn_param.is_quiet()) {
report_mem_usage("After mk_mech");
}

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

report_mem_usage("After nrn_finitialize");
if (!corenrn_param.is_quiet()) {
report_mem_usage("After nrn_finitialize");
}

// register all reports into reportinglib
double min_report_dt = INT_MAX;
Expand Down
4 changes: 2 additions & 2 deletions coreneuron/io/mk_mech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include "coreneuron/coreneuron.hpp"
#include "coreneuron/mechanism//eion.hpp"

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

namespace coreneuron {
int nrn_nobanner_;
extern int nrn_nobanner_;

// NB: this should go away
extern const char* nrn_version(int);
Expand Down
4 changes: 3 additions & 1 deletion coreneuron/io/nrn_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <cstring>

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

if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
printf(" Setup Done : %.2lf seconds \n", nrn_wtime() - time);
}
}
Expand Down
4 changes: 3 additions & 1 deletion coreneuron/network/netpar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include <map>

#include "coreneuron/nrnconf.h"
#include "coreneuron/apps/corenrn_parameters.hpp"
#include "coreneuron/sim/multicore.hpp"
#include "coreneuron/mpi/nrnmpi.h"
#include "coreneuron/mpi/nrnmpidec.h"
Expand All @@ -50,6 +51,7 @@ THE POSSIBILITY OF SUCH DAMAGE.

namespace coreneuron {

extern corenrn_parameters corenrn_param;
class PreSyn;
class InputPreSyn;

Expand Down Expand Up @@ -728,7 +730,7 @@ void BBS_netpar_solve(double tstop) {
#endif
tstopunset;

if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
printf("\nSolver Time : %g\n", nrn_wtime() - time);
}
}
Expand Down
8 changes: 5 additions & 3 deletions coreneuron/sim/fadvance_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ THE POSSIBILITY OF SUCH DAMAGE.

#include "coreneuron/coreneuron.hpp"
#include "coreneuron/nrnconf.h"
#include "coreneuron/apps/corenrn_parameters.hpp"
#include "coreneuron/sim/multicore.hpp"
#include "coreneuron/mpi/nrnmpi.h"
#include "coreneuron/sim/fast_imem.hpp"
Expand All @@ -45,6 +46,7 @@ THE POSSIBILITY OF SUCH DAMAGE.

namespace coreneuron {

extern corenrn_parameters corenrn_param;
static void* nrn_fixed_step_thread(NrnThread*);
static void* nrn_fixed_step_group_thread(NrnThread*, int, int, int&);

Expand Down Expand Up @@ -94,20 +96,20 @@ integration interval before joining
static progressbar* progress;

void initialize_progress_bar(int nstep) {
if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
printf("\n");
progress = progressbar_new(" psolve", nstep);
}
}

void update_progress_bar(int step, double time) {
if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
progressbar_update(progress, step, time);
}
}

void finalize_progress_bar() {
if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
progressbar_finish(progress);
}
}
Expand Down
8 changes: 3 additions & 5 deletions coreneuron/utils/nrn_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdio>
#include <climits>
#include <vector>
#include "coreneuron/apps/corenrn_parameters.hpp"
#include "coreneuron/utils/nrn_stats.h"
#include "coreneuron/mpi/nrnmpi.h"
#include "coreneuron/sim/multicore.hpp"
Expand All @@ -44,6 +45,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include "coreneuron/io/output_spikes.hpp"
namespace coreneuron {
extern NetCvode* net_cvode_instance;
extern corenrn_parameters corenrn_param;

const int NUM_STATS = 12;
#if COLLECT_TQueue_STATISTICS
Expand Down Expand Up @@ -155,7 +157,7 @@ void report_cell_stats(void) {
memcpy(gstat_array, stat_array, sizeof(stat_array));
#endif

if (nrnmpi_myid == 0) {
if (nrnmpi_myid == 0 && !corenrn_param.is_quiet()) {
printf("\n\n Simulation Statistics\n");
printf(" Number of cells: %ld\n", gstat_array[0]);
printf(" Number of compartments: %ld\n", gstat_array[10]);
Expand Down Expand Up @@ -209,9 +211,5 @@ void report_cell_stats(void) {
nrnmpi_barrier();
}
#endif
if (nrnmpi_myid == 0) {
printf("\n\n");
fflush(stdout);
}
}
} // namespace coreneuron