Skip to content

Commit

Permalink
Multisend available in NEURON by default. (#1537)
Browse files Browse the repository at this point in the history
* Multisend available in NEURON by default.

* pc.spike_compress(-1) acts according to documentation (does not
change any multisend properties).

 * neuron.coreneuron specifies correct multisend args derived
from current NEURON settings from pc.spike_compress third arg
(available from pc.send_time(8))

* BGPDMA is on only if NRNMPI is on.

* When ~PreSyn, remove from gid to PreSyn maps.

* Consistent praxis prototype. Fixes int vs long int problem on arm64.
  • Loading branch information
nrnhines committed Dec 14, 2021
1 parent 903136d commit 7e5cbd7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions cmake/ConfigFileSetting.cmake
Expand Up @@ -39,6 +39,7 @@ set(bindir \${exec_prefix}/bin)
set(modsubdir ${host_cpu})
set(bindir \${exec_prefix}/bin)
set(libdir \${exec_prefix}/lib)
set(BGPDMA ${NRNMPI})

# =============================================================================
# Comment or empty character to enable/disable cmake specific settings
Expand Down
2 changes: 1 addition & 1 deletion external/coreneuron
8 changes: 4 additions & 4 deletions share/lib/python/neuron/coreneuron.py
Expand Up @@ -201,12 +201,12 @@ def nrncore_arg(self, tstop):
multisend = int(pc.send_time(8))
if (multisend & 1) == 1:
arg += " --multisend"
interval = (multisend & 2) / 2 + 1
interval = (multisend & 4) / 4 + 1
if interval != 2:
arg += " --ms_subinterval %d" % interval
phases = (multisend & 4) / 4 + 1
arg += " --ms-subintervals %d" % interval
phases = (multisend & 8) / 8 + 1
if phases != 2:
arg += " --ms_phases %d" % phases
arg += " --ms-phases %d" % phases

return arg

Expand Down
8 changes: 7 additions & 1 deletion src/nrniv/bgpdmasetup.cpp
Expand Up @@ -132,7 +132,13 @@ static void all2allv_helper(int* scnt, int* sdispl, int*& rcnt, int*& rdispl) {
rdispl = newoffset(rcnt, np);
}

#define all2allv_perf 1
/*
define following to 1 if desire space/performance information such as:
all2allv_int gidin to intermediate space=1552 total=37345104 time=0.000495835
all2allv_int gidout space=528 total=37379376 time=1.641e-05
all2allv_int lists space=3088 total=37351312 time=4.4708e-05
*/
#define all2allv_perf 0
extern "C" {
extern unsigned long long nrn_mallinfo(int);
} // extern "C"
Expand Down
10 changes: 8 additions & 2 deletions src/nrniv/netpar.cpp
Expand Up @@ -966,8 +966,14 @@ void nrn_cleanup_presyn(PreSyn* ps) {
bgpdma_cleanup_presyn(ps);
#endif
PreSyn* pss;
if (ps->output_index_ >= 0 && gid2out_) {
gid2out_->remove(ps->output_index_);
ps->output_index_ = -1;
ps->gid_ = -1;
}
if (ps->gid_ >= 0 && gid2in_ && gid2in_donot_remove == 0) {
gid2in_->remove(ps->gid_);
ps->gid_ = -1;
}
}

Expand Down Expand Up @@ -1452,18 +1458,18 @@ See case 8 of nrn_bgp_receive_time for the xchng_meth properties
int nrnmpi_spike_compress(int nspike, bool gid_compress, int xchng_meth) {
#if NRNMPI
if (nrnmpi_numprocs < 2) { return 0; }
if (nspike >= 0) { // otherwise don't set any multisend properties
#if BGP_INTERVAL == 2
n_bgp_interval = (xchng_meth & 4) ? 2 : 1;
#endif
#if BGPDMA
use_bgpdma_ = (xchng_meth & 1) == 1;
use_phase2_ = (xchng_meth & 8) ? 1 : 0;
if (nrnmpi_myid == 0) {Printf("use_phase2_ = %d\n", use_phase2_);}
if (use_bgpdma_) { assert(BGPDMA); }
if (nrnmpi_myid == 0) {Printf("use_bgpdma_ = %d\n", use_bgpdma_);}
#else // BGPDMA == 0
assert(xchng_meth == 0);
#endif
}
if (nspike >= 0) {
ag_send_nspike_ = 0;
if (spfixout_) { free(spfixout_); spfixout_ = 0; }
Expand Down
9 changes: 6 additions & 3 deletions src/nrnoc/hocprax.cpp
Expand Up @@ -44,7 +44,10 @@ pval = pval_praxis(i, Vector)
extern "C" {
#endif

extern double praxis(...), praxis_pval(int), *praxis_paxis(int);
extern double praxis(double* t0, double* machep, double* h0,
long int nval, long int* prin, double* x, double(*f)(double*, long int),
double* fmin, char* after_quad);
extern double praxis_pval(int), *praxis_paxis(int);
extern int praxis_stop(int);

#if defined(__cplusplus)
Expand All @@ -64,7 +67,7 @@ extern Object** vector_pobj(IvocVect* v);
extern int nrn_praxis_ran_index;
extern Object** hoc_objgetarg(int);

static double efun(double*, int);
static double efun(double*, long int);
static Symbol* hoc_efun_sym;

static double tolerance, machep, maxstepsize;
Expand Down Expand Up @@ -269,7 +272,7 @@ void pval_praxis(void) {
hoc_retpushx(praxis_pval(i));
}

static double efun(double* v, int n)
static double efun(double* v, long int n)
{
int i;
double err;
Expand Down
3 changes: 2 additions & 1 deletion src/nrnoc/nrntimeout.cpp
Expand Up @@ -3,14 +3,15 @@


#if NRNMPI
void (*nrntimeout_call)();

#if defined(HAVE_SETITIMER) && defined(HAVE_SIGACTION)

#include <stdio.h>
#include <signal.h>
#include <sys/time.h>
#include <section.h>

void (*nrntimeout_call)();
static double told;
static struct itimerval value;
static struct sigaction act, oact;
Expand Down

0 comments on commit 7e5cbd7

Please sign in to comment.