1 #include <../../nrnconf.h>
23 void nrnmpi_split_clear();
24 extern void (*nrnmpi_splitcell_compute_)();
26 extern void nrnmpi_recv_doubles(
double*,
int cnt,
int src,
int tag);
29 static int change_cnt_;
30 static void transfer();
31 static void set_structure();
32 static void splitcell_compute();
39 static std::vector<SplitCell> splitcell_list_;
43 static bool splitcell_connected_[2];
44 static double* transfer_p_[4];
53 hoc_execerror(
"cells may be split only on adjacent hosts", 0);
61 nrnmpi_splitcell_compute_ = splitcell_compute;
62 for (
size_t i = 0;
i < 2; ++
i)
64 if (splitcell_connected_[
i]) {
69 splitcell_connected_[
i] =
true;
71 splitcell_list_.push_back({rootsec, that_host});
75 "NEURON not configured with --with-paranrn");
82 void nrnmpi_split_clear() {
83 if (nrnmpi_splitcell_compute_ == splitcell_compute) {
90 void splitcell_compute() {
99 double trans[2], trans_sav[2];
101 if (transfer_p_[ip]) {
102 trans[0] = *transfer_p_[ip + 0];
103 trans[1] = *transfer_p_[ip + 1];
106 if (transfer_p_[im]) {
107 nrnmpi_recv_doubles(trans_sav, 2,
nrnmpi_myid - 1, 1);
110 trans[0] = *transfer_p_[im + 0];
111 trans[1] = *transfer_p_[im + 1];
112 *transfer_p_[im + 0] += trans_sav[0];
113 *transfer_p_[im + 1] += trans_sav[1];
116 if (transfer_p_[ip]) {
118 *transfer_p_[ip + 0] += trans[0];
119 *transfer_p_[ip + 1] += trans[1];
125 void set_structure() {
126 for (
auto& sc: splitcell_list_) {
128 transfer_p_[ip + 0] = &
NODED(sc.rootsec_->parentnode);
129 transfer_p_[ip + 1] = &
NODERHS(sc.rootsec_->parentnode);
132 transfer_p_[im + 0] = &
NODED(sc.rootsec_->parentnode);
133 transfer_p_[im + 1] = &
NODERHS(sc.rootsec_->parentnode);
const char * secname(Section *sec)
Section * chk_access(void)
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
void hoc_execerror(const char *, const char *)
static double nrnmpi_splitcell_wait_
static double nrnmpi_wtime()
static void nrnmpi_send_doubles(double *, int, int, int)
void nrnmpi_splitcell_connect(int that_host)
struct Section * parentsec