39 extern MPI::Intracomm
comm;
60 std::vector<T>& recv_buffer,
61 std::vector<int>& displacements,
62 std::vector<int>& recv_counts)
69 template <
typename NodeListType>
71 vector<NodeAddressingData>& all_nodes,
77 vector<long_t> localnodes;
78 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
80 localnodes.push_back((*n)->get_gid());
81 localnodes.push_back(((*n)->get_parent())->get_gid());
82 localnodes.push_back((*n)->get_vp());
85 std::vector<nest::int_t> n_nodes(np);
89 std::vector<int> displacements(np,0);
91 for (
size_t i = 1; i < np; ++i )
92 displacements.at(i) = displacements.at(i-1)+n_nodes.at(i-1);
96 std::accumulate(n_nodes.begin(),n_nodes.end(), 0);
97 assert(n_globals % 3 == 0);
98 vector<long_t> globalnodes;
101 globalnodes.resize(n_globals,0L);
102 communicate_Allgatherv<nest::long_t>(localnodes, globalnodes, displacements, n_nodes);
105 for (
size_t i = 0; i < n_globals -2; i +=3)
106 all_nodes.push_back(
NodeAddressingData(globalnodes[i],globalnodes[i+1],globalnodes[i+2]));
109 std::sort(all_nodes.begin(), all_nodes.end());
110 vector<NodeAddressingData>::iterator it;
111 it = std::unique(all_nodes.begin(), all_nodes.end());
112 all_nodes.resize(it - all_nodes.begin());
117 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
119 ((*n)->get_parent())->get_gid(),
121 std::sort(all_nodes.begin(), all_nodes.end());
126 template <
typename NodeListType>
128 vector<NodeAddressingData>& all_nodes,
134 if ( np > 1 && remote)
136 vector<long_t> localnodes;
139 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
141 localnodes.push_back((*n)->get_gid());
142 localnodes.push_back(((*n)->get_parent())->get_gid());
143 localnodes.push_back((*n)->get_vp());
146 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
150 index gid = (*n)->get_gid();
152 for (Dictionary::iterator i = params->begin(); i != params->end(); ++i)
154 if (node_status->known(i->first))
156 const Token token = node_status->lookup(i->first);
166 localnodes.push_back(gid);
167 localnodes.push_back(((*n)->get_parent())->get_gid());
168 localnodes.push_back((*n)->get_vp());
174 std::vector<nest::int_t> n_nodes(np);
176 communicate(n_nodes);
179 std::vector<int> displacements(np,0);
181 for (
size_t i = 1; i < np; ++i )
182 displacements.at(i) = displacements.at(i-1)+n_nodes.at(i-1);
186 std::accumulate(n_nodes.begin(),n_nodes.end(), 0);
187 assert(n_globals % 3 == 0);
188 vector<long_t> globalnodes;
191 globalnodes.resize(n_globals,0L);
192 communicate_Allgatherv<nest::long_t>(localnodes, globalnodes, displacements, n_nodes);
195 for (
size_t i = 0; i < n_globals -2; i +=3)
196 all_nodes.push_back(
NodeAddressingData(globalnodes[i],globalnodes[i+1],globalnodes[i+2]));
199 std::sort(all_nodes.begin(), all_nodes.end());
200 vector<NodeAddressingData>::iterator it;
201 it = std::unique(all_nodes.begin(), all_nodes.end());
202 all_nodes.resize(it - all_nodes.begin());
209 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
210 all_nodes.push_back(
NodeAddressingData((*n)->get_gid(), ((*n)->get_parent())->get_gid(), (*n)->get_vp()));
214 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
217 index gid = (*n)->get_gid();
219 for (Dictionary::iterator i = params->begin(); i != params->end(); ++i)
221 if (node_status->known(i->first))
223 const Token token = node_status->lookup(i->first);
232 all_nodes.push_back(
NodeAddressingData((*n)->get_gid(), ((*n)->get_parent())->get_gid(), (*n)->get_vp()));
235 std::sort(all_nodes.begin(),all_nodes.end());
243 template <
typename NodeListType>
246 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
247 all_nodes.push_back(NodeAddressingData((*n)->get_gid(), ((*n)->get_parent())->get_gid(), (*n)->get_vp()));
248 std::sort(all_nodes.begin(),all_nodes.end());
251 template <
typename NodeListType>
258 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
259 all_nodes.push_back(NodeAddressingData((*n)->get_gid(), ((*n)->get_parent())->get_gid(), (*n)->get_vp()));
263 for (
typename NodeListType::iterator
n = local_nodes.begin();
n != local_nodes.end(); ++
n )
266 index gid = (*n)->get_gid();
268 for (Dictionary::iterator i = params->begin(); i != params->end(); ++i)
270 if (node_status->known(i->first))
272 const Token token = node_status->lookup(i->first);
281 all_nodes.push_back(NodeAddressingData((*n)->get_gid(), ((*n)->get_parent())->get_gid(), (*n)->get_vp()));
284 std::sort(all_nodes.begin(),all_nodes.end());
size_t index
Unsigned long type for enumerations.
Definition: nest.h:109
Definition: communicator_impl.h:56
static int num_processes_
the number of mpi-processes
Definition: communicator.h:220
Definition: communicator.h:110
static MPI_Datatype type
Definition: communicator_impl.h:56
static int rank_
the rank of the machine
Definition: communicator.h:219
MPI::Intracomm comm
Definition: communicator_impl.h:41
static void communicate_Allgatherv(std::vector< T > &send_buffer, std::vector< T > &recv_buffer, std::vector< int > &displacements, std::vector< int > &recv_counts)
Definition: communicator_impl.h:59
static void communicate(std::vector< uint_t > &send_buffer, std::vector< uint_t > &recv_buffer, std::vector< int > &displacements)
communicate (on-grid) if compiled without MPI
Definition: communicator.cpp:239
Declarations for class Network.
Main administrative interface to the network.
Definition: network.h:135
bool matches_as_string(const Token &rhs) const
Returns true if token equals rhs as string.
Definition: token.cc:178
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
A type-independent container for C++-types.
Definition: token.h:68
DictionaryDatum get_status(index)
Get properties of a node.
Definition: network.cpp:837