56 #if !defined(DCMFTICK)
58 #define DCMFTIMEBASE 0
74 #define TBUFSIZE (1 << 15)
80 static unsigned long tbuf_[
TBUFSIZE];
86 static unsigned long t__;
90 tbuf_[itbuf_++] = t__; \
93 #define TBUF tbuf_[itbuf_++] = (unsigned long) DCMF_Timebase();
112 #define PHASE2BUFFER_SIZE 2048
113 #define PHASE2BUFFER_MASK (PHASE2BUFFER_SIZE - 1)
123 #define BGP_RECEIVEBUFFER_SIZE 10000
129 void incoming(
int gid,
double spiketime);
155 #define NTARGET_HOSTS_PHASE1 ntarget_hosts_phase1_
161 void send(
int gid,
double t);
181 #if BGP_INTERVAL == 2
262 PreSyn* ps = iter->second;
293 void BGP_ReceiveBuffer::enqueue1() {
302 PreSyn* ps = iter->second;
318 void BGP_ReceiveBuffer::enqueue2() {
375 if (
ifarg(2) && use_bgpdma_) {
387 for (
int i = 0;
i <= itbuf_; ++
i) {
402 int method = use_bgpdma_ ? 1 : 0;
449 #if BGP_INTERVAL == 2
462 void nrnbgp_messager_advance() {
500 static void mymulticast(DCMF_Multicast_t*
arg) {
503 static void myrestart(DCMF_Request_t*
arg) {
513 #if BGP_INTERVAL == 2
538 #if BGP_INTERVAL == 2
561 #if ENQUEUE == 2 && TBUFSIZE
562 unsigned long tfind, tsend;
567 nrnbgp_messager_advance();
569 #if ENQUEUE == 2 && TBUFSIZE
578 nrnbgp_messager_advance();
587 tbuf_[itbuf_++] = (
unsigned long)
ncons;
589 tbuf_[itbuf_++] = (
unsigned long) s;
590 tbuf_[itbuf_++] = (
unsigned long) r;
597 #if (BGPMDA & 2) && MAXNCONS
618 tbuf_[itbuf_++] = tfind;
619 tbuf_[itbuf_++] = tsend;
624 #if BGP_INTERVAL == 2
636 if (nrn_use_localgid_) {
637 nrn_outputevent(ps->localgid_,
t);
642 if (ps->bgp.dma_send_)
647 if (ps && ps->bgp.dma_send_) {
649 delete ps->bgp.dma_send_;
650 ps->bgp.dma_send_ = 0;
653 delete ps->bgp.dma_send_phase2_;
654 ps->bgp.dma_send_phase2_ = 0;
664 for (
const auto& iter:
gid2in_) {
671 #if BGP_INTERVAL == 2
684 static void bgptimeout() {
685 printf(
"%d timeout %d %d %d\n",
693 #if WORK_AROUND_RECORD_BUG
702 for (
int i = 0;
i < nold; ++
i) {
758 #error "FASTSETUP required"
764 #if BGP_INTERVAL == 2
774 int ncs_bgp_sending_info(
int** sendlist2build) {
777 if (iter.second->output_index_ >= 0) {
782 *sendlist2build = nsrcgid ?
new int[nsrcgid] : 0;
784 for (
const auto& iter: gid2out) {
787 (*sendlist2build)[
i] = ps->
gid_;
800 int ncs_bgp_target_hosts(
int gid,
int** targetnodes) {
803 PreSyn* ps = iter->second;
804 if (ps->bgp.dma_send_) {
805 (*targetnodes) = ps->bgp.dma_send_->ntarget_hosts_
806 ?
new int[ps->bgp.dma_send_->ntarget_hosts_]
808 return ps->bgp.dma_send_->ntarget_hosts_;
815 int ncs_bgp_target_info(
int** presyngids) {
823 for (
const auto& iter:
gid2in_) {
826 if (ps->bgp.srchost_ != -1) {
833 (*presyngids) = nsrcgid ?
new int[nsrcgid] : 0;
836 for (
const auto& iter:
gid2in_) {
839 if (ps->bgp.srchost_ != -1) {
840 (*presyngids)[
i] = ps->
gid_;
848 int ncs_bgp_mindelays(
int** srchost,
double** delays) {
851 for (
const auto& iter:
gid2in_) {
854 if (ps->bgp.srchost_ != -1) {
859 (*delays) = nsrcgid ?
new double[nsrcgid] : 0;
860 (*srchost) = nsrcgid ?
new int[nsrcgid] : 0;
863 for (
const auto& iter:
gid2in_) {
866 if (ps->bgp.srchost_ != -1) {
868 (*srchost)[
i] = ps->bgp.srchost_;
static void nrnmpi_barrier()
void bgp_dma_receive(NrnThread *nt)
void nrnmpi_bgp_multisend(NRNMPI_Spike *, int, int *)
#define BGP_RECEIVEBUFFER_SIZE
Pool< NRNMPI_Spike > SpkPool
void vector_resize(IvocVect *, int)
#define PHASE2BUFFER_MASK
static unsigned long enq2_enqueue_time_
void(* nrntimeout_call)()
static unsigned long long dmasend_time_
double nrn_bgp_receive_time(int type)
static BGP_ReceiveBuffer * bgp_receive_buffer[BGP_INTERVAL]
static int max_multisend_targets
static void bgpdma_cleanup()
void bgpdma_cleanup_presyn(PreSyn *ps)
static void bgp_dma_init()
static int n_xtra_cons_check_
#define NTARGET_HOSTS_PHASE1
void bgp_dma_send(PreSyn *ps, double t)
IvocVect * vector_arg(int)
int nrnmpi_bgp_conserve(int nsend, int nrecv)
static int max_ntarget_host
static unsigned long enq2_find_time_
static int xtra_cons_hist_[MAXNCONS+1]
int nrnmpi_bgp_single_advance(NRNMPI_Spike *)
#define PHASE2BUFFER_SIZE
static void setup_presyn_dma_lists()
int * target_hosts_phase2_
int ntarget_hosts_phase2_
virtual ~BGP_DMASend_Phase2()
void send_phase2(int gid, double t, BGP_ReceiveBuffer *)
void send(int gid, double t)
int ntarget_hosts_phase1_
virtual ~BGP_ReceiveBuffer()
unsigned long long timebase_
void incoming(int gid, double spiketime)
Phase2Buffer * phase2_buffer_
virtual void send(double sendtime, NetCvode *, NrnThread *)
NetCvode * net_cvode_instance
double * vector_vec(Vect *v)
static double nrnmpi_wtime()
static Gid2PreSyn gid2out_
static Gid2PreSyn gid2in_
static int n_bgp_interval
Represent main neuron object computed by single thread.