diff --git a/coreneuron/coreneuron.h b/coreneuron/coreneuron.h index 7fe78d38a..986b97ac9 100644 --- a/coreneuron/coreneuron.h +++ b/coreneuron/coreneuron.h @@ -30,7 +30,7 @@ THE POSSIBILITY OF SUCH DAMAGE. * Includes all headers required to communicate and run all methods * described in CoreNeuron, neurox, and mod2c C-generated mechanisms * functions. -**/ + **/ #ifndef CORENEURON_H #define CORENEURON_H diff --git a/coreneuron/nrniv/multisend.cpp b/coreneuron/nrniv/multisend.cpp index 08f55bb8c..f0cfca81e 100644 --- a/coreneuron/nrniv/multisend.cpp +++ b/coreneuron/nrniv/multisend.cpp @@ -42,7 +42,6 @@ of spikes sent is equal to the number of spikes sent. // which has the greatest amount of overlap between computation // and communication. - int use_multisend_; int use_phase2_; int n_multisend_interval = 2; @@ -104,7 +103,6 @@ class Multisend_ReceiveBuffer { Phase2Buffer* phase2_buffer_; }; - #define MULTISEND_INTERVAL 2 static Multisend_ReceiveBuffer* multisend_receive_buffer[MULTISEND_INTERVAL]; static int current_rbuf, next_rbuf; @@ -468,4 +466,4 @@ void nrn_multisend_setup() { #endif } -#endif //NRN_MULTISEND +#endif // NRN_MULTISEND diff --git a/coreneuron/nrniv/multisend_setup.cpp b/coreneuron/nrniv/multisend_setup.cpp index b680e50cf..19d3d934e 100644 --- a/coreneuron/nrniv/multisend_setup.cpp +++ b/coreneuron/nrniv/multisend_setup.cpp @@ -703,4 +703,4 @@ static int setup_target_lists(int use_phase2, int** r_return) { return sz; } -#endif //NRN_MULTISEND +#endif // NRN_MULTISEND diff --git a/coreneuron/nrniv/output_spikes.cpp b/coreneuron/nrniv/output_spikes.cpp index d6d16e7ad..74c409b25 100644 --- a/coreneuron/nrniv/output_spikes.cpp +++ b/coreneuron/nrniv/output_spikes.cpp @@ -29,7 +29,7 @@ THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include // std::lenght_error +#include // std::lenght_error #include #include "coreneuron/nrnconf.h" #include "coreneuron/nrniv/nrniv_decl.h" @@ -47,10 +47,10 @@ static MUTDEC void mk_spikevec_buffer(int sz) { try { - spikevec_time.reserve(sz); - spikevec_gid.reserve(sz); + spikevec_time.reserve(sz); + spikevec_gid.reserve(sz); } catch (const std::length_error& le) { - std::cerr << "Lenght error" << le.what() << std::endl; + std::cerr << "Lenght error" << le.what() << std::endl; } MUTCONSTRUCT(1); } @@ -74,7 +74,7 @@ void output_spikes_parallel(const char* outpath) { std::string fname = ss.str(); // remove if file already exist - if(nrnmpi_myid == 0) { + if (nrnmpi_myid == 0) { remove(fname.c_str()); } nrnmpi_barrier(); @@ -83,9 +83,9 @@ void output_spikes_parallel(const char* outpath) { const int SPIKE_RECORD_LEN = 64; unsigned num_spikes = spikevec_gid.size(); unsigned num_bytes = (sizeof(char) * num_spikes * SPIKE_RECORD_LEN); - char *spike_data = (char*) malloc(num_bytes); + char* spike_data = (char*)malloc(num_bytes); - if(spike_data == NULL) { + if (spike_data == NULL) { printf("Error while writing spikes due to memory allocation\n"); return; } @@ -95,7 +95,7 @@ void output_spikes_parallel(const char* outpath) { // populate buffer with all spike entries char spike_entry[SPIKE_RECORD_LEN]; - for(unsigned i = 0; i < num_spikes; i++) { + for (unsigned i = 0; i < num_spikes; i++) { snprintf(spike_entry, 64, "%.8g\t%d\n", spikevec_time[i], spikevec_gid[i]); strcat(spike_data, spike_entry); } @@ -113,14 +113,15 @@ void output_spikes_parallel(const char* outpath) { MPI_Status status; // ibm mpi (bg-q) expects char* instead of const char* (even though it's standard) - int op_status = MPI_File_open(MPI_COMM_WORLD, (char*) fname.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); - if(op_status != MPI_SUCCESS && nrnmpi_myid == 0) { + int op_status = MPI_File_open(MPI_COMM_WORLD, (char*)fname.c_str(), + MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); + if (op_status != MPI_SUCCESS && nrnmpi_myid == 0) { std::cerr << "Error while opening spike output file " << fname << std::endl; abort(); } op_status = MPI_File_write_at_all(fh, offset, spike_data, num_chars, MPI_BYTE, &status); - if(op_status != MPI_SUCCESS && nrnmpi_myid == 0) { + if (op_status != MPI_SUCCESS && nrnmpi_myid == 0) { std::cerr << "Error while writing spike output " << std::endl; abort(); } @@ -152,7 +153,7 @@ void output_spikes_serial(const char* outpath) { void output_spikes(const char* outpath) { #if NRNMPI - if(nrnmpi_initialized()) { + if (nrnmpi_initialized()) { output_spikes_parallel(outpath); } else { output_spikes_serial(outpath); @@ -162,7 +163,6 @@ void output_spikes(const char* outpath) { #endif } - void validation(std::vector >& res) { for (unsigned i = 0; i < spikevec_gid.size(); ++i) if (spikevec_gid[i] > -1) diff --git a/coreneuron/nrniv/patternstim.cpp b/coreneuron/nrniv/patternstim.cpp index 5e3776ca9..114911b16 100644 --- a/coreneuron/nrniv/patternstim.cpp +++ b/coreneuron/nrniv/patternstim.cpp @@ -85,7 +85,7 @@ void nrn_mkPatternStim(const char* fname) { } // if there is empty thread then return, don't need patternstim - if(nrn_threads == NULL || nrn_threads->ncell == 0) { + if (nrn_threads == NULL || nrn_threads->ncell == 0) { return; } @@ -120,7 +120,7 @@ void nrn_mkPatternStim(const char* fname) { // comparator to sort spikes based on time typedef std::pair spike_type; static bool spike_comparator(const spike_type& l, const spike_type& r) { - return l.first < r.first; + return l.first < r.first; } size_t read_raster_file(const char* fname, double** tvec, int** gidvec) { @@ -146,15 +146,15 @@ size_t read_raster_file(const char* fname, double** tvec, int** gidvec) { // pattern.mod expects sorted spike raster (this is to avoid // injecting all events at the begining of the simulation). // sort spikes according to time - std::sort(spikes.begin(), spikes.end(), spike_comparator); + std::sort(spikes.begin(), spikes.end(), spike_comparator); // fill gid and time vectors *tvec = (double*)emalloc(spikes.size() * sizeof(double)); *gidvec = (int*)emalloc(spikes.size() * sizeof(int)); - for(size_t i = 0; i < spikes.size(); i++) { - (*tvec)[i] = spikes[i].first; - (*gidvec)[i] = spikes[i].second; + for (size_t i = 0; i < spikes.size(); i++) { + (*tvec)[i] = spikes[i].first; + (*gidvec)[i] = spikes[i].second; } return spikes.size(); @@ -171,7 +171,7 @@ Point_process* nrn_artcell_instantiate(const char* mechname) { int type = nrn_get_mechtype(mechname); NrnThread* nt = nrn_threads + 0; - //printf("nrn_artcell_instantiate %s type=%d\n", mechname, type); + // printf("nrn_artcell_instantiate %s type=%d\n", mechname, type); // see nrn_setup.cpp:read_phase2 for how it creates NrnThreadMembList instances. // create and append to nt.tml diff --git a/coreneuron/nrnoc/solve_core.c b/coreneuron/nrnoc/solve_core.c index f6b508a95..0bbf9655f 100644 --- a/coreneuron/nrnoc/solve_core.c +++ b/coreneuron/nrnoc/solve_core.c @@ -32,7 +32,7 @@ THE POSSIBILITY OF SUCH DAMAGE. int use_solve_interleave; -static void triang(NrnThread *), bksub(NrnThread *); +static void triang(NrnThread*), bksub(NrnThread*); /* solve the matrix equation */ void nrn_solve_minimal(NrnThread* _nt) { @@ -63,9 +63,12 @@ static void triang(NrnThread* _nt) { #endif /** @todo: just for benchmarking, otherwise produces wrong results */ -#pragma acc parallel loop seq present( \ - vec_a[0 : i3], vec_b[0 : i3], vec_d[0 : i3], vec_rhs[0 : i3], parent_index[0 : i3]) \ - async(stream_id) if (_nt->compute_gpu) +// clang-format off + #pragma acc parallel loop seq present( \ + vec_a[0:i3], vec_b[0:i3], vec_d[0:i3], \ + vec_rhs[0:i3], parent_index[0:i3]) \ + async(stream_id) if (_nt->compute_gpu) + // clang-format on for (i = i3 - 1; i >= i2; --i) { p = vec_a[i] / vec_d[i]; vec_d[parent_index[i]] -= p * vec_b[i]; diff --git a/coreneuron/scopmath_core/dimplic.c b/coreneuron/scopmath_core/dimplic.c index 2f6b9c3a7..795516a63 100644 --- a/coreneuron/scopmath_core/dimplic.c +++ b/coreneuron/scopmath_core/dimplic.c @@ -10,7 +10,7 @@ * time. * \todo: eulerfun/difun are legacy macros and can be replaced with * actual steer function for euler/derivimplicit methods. -*/ + */ #include "coreneuron/mech/cfile/scoplib.h" #include "coreneuron/mech/mod2c_core_thread.h" @@ -44,16 +44,15 @@ int nrn_kinetic_steer(int fun, SparseObj* so, double* rhs, _threadargsproto_) { // derived from nrn/src/scopmath/euler.c // updated for aos/soa layout index int euler_thread(int neqn, int* var, int* der, DIFUN fun, _threadargsproto_) { - double dt = _nt->_dt; int i; /* calculate the derivatives */ - eulerfun(fun); + eulerfun(fun); /* update dependent variables */ for (i = 0; i < neqn; i++) - _p[var[i]*_STRIDE] += dt * (_p[der[i]*_STRIDE]); + _p[var[i] * _STRIDE] += dt * (_p[der[i] * _STRIDE]); return 0; }