1 #include <../../nrnconf.h>
22 void nrnmpi_split_clear();
23 extern void (*nrnmpi_splitcell_compute_)();
25 extern void nrnmpi_recv_doubles(
double*,
int cnt,
int src,
int tag);
28 static int change_cnt_;
29 static void transfer();
30 static void set_structure();
31 static void splitcell_compute();
38 static std::vector<SplitCell> splitcell_list_;
42 static bool splitcell_connected_[2];
43 static double* transfer_p_[4];
52 hoc_execerror(
"cells may be split only on adjacent hosts", 0);
60 nrnmpi_splitcell_compute_ = splitcell_compute;
61 for (
size_t i = 0;
i < 2; ++
i)
63 if (splitcell_connected_[
i]) {
68 splitcell_connected_[
i] =
true;
70 splitcell_list_.push_back({rootsec, that_host});
74 "NEURON not configured with --with-paranrn");
81 void nrnmpi_split_clear() {
82 if (nrnmpi_splitcell_compute_ == splitcell_compute) {
89 void splitcell_compute() {
98 double trans[2], trans_sav[2];
100 if (transfer_p_[ip]) {
101 trans[0] = *transfer_p_[ip + 0];
102 trans[1] = *transfer_p_[ip + 1];
105 if (transfer_p_[im]) {
106 nrnmpi_recv_doubles(trans_sav, 2,
nrnmpi_myid - 1, 1);
109 trans[0] = *transfer_p_[im + 0];
110 trans[1] = *transfer_p_[im + 1];
111 *transfer_p_[im + 0] += trans_sav[0];
112 *transfer_p_[im + 1] += trans_sav[1];
115 if (transfer_p_[ip]) {
117 *transfer_p_[ip + 0] += trans[0];
118 *transfer_p_[ip + 1] += trans[1];
124 void set_structure() {
125 for (
auto& sc: splitcell_list_) {
127 transfer_p_[ip + 0] = &
NODED(sc.rootsec_->parentnode);
128 transfer_p_[ip + 1] = &
NODERHS(sc.rootsec_->parentnode);
131 transfer_p_[im + 0] = &
NODED(sc.rootsec_->parentnode);
132 transfer_p_[im + 1] = &
NODERHS(sc.rootsec_->parentnode);
const char * secname(Section *sec)
name of section (for use in error messages)
static double nrnmpi_splitcell_wait_
static double nrnmpi_wtime()
static void nrnmpi_send_doubles(double *, int, int, int)
void hoc_execerror(const char *s1, const char *s2)
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
void nrnmpi_splitcell_connect(int that_host)