annotate DEPENDENCIES/generic/include/boost/graph/distributed/adjlist/serialization.hpp @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright Daniel Wallin 2007. Use, modification and distribution is
Chris@16 2 // subject to the Boost Software License, Version 1.0. (See accompanying
Chris@16 3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 4
Chris@16 5 #ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP
Chris@16 6 #define BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP
Chris@16 7
Chris@16 8 #ifndef BOOST_GRAPH_USE_MPI
Chris@16 9 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
Chris@16 10 #endif
Chris@16 11
Chris@16 12 # include <boost/assert.hpp>
Chris@16 13 # include <boost/lexical_cast.hpp>
Chris@16 14 # include <boost/foreach.hpp>
Chris@16 15 # include <boost/filesystem/path.hpp>
Chris@16 16 # include <boost/filesystem/operations.hpp>
Chris@16 17 # include <cctype>
Chris@16 18 # include <fstream>
Chris@16 19
Chris@16 20 namespace boost {
Chris@16 21
Chris@16 22 namespace detail { namespace parallel
Chris@16 23 {
Chris@16 24
Chris@16 25 // Wraps a local descriptor, making it serializable.
Chris@16 26 template <class Local>
Chris@16 27 struct serializable_local_descriptor
Chris@16 28 {
Chris@16 29 serializable_local_descriptor()
Chris@16 30 {}
Chris@16 31
Chris@16 32 serializable_local_descriptor(Local local)
Chris@16 33 : local(local)
Chris@16 34 {}
Chris@16 35
Chris@16 36 operator Local const&() const
Chris@16 37 {
Chris@16 38 return local;
Chris@16 39 }
Chris@16 40
Chris@16 41 bool operator==(serializable_local_descriptor const& other) const
Chris@16 42 {
Chris@16 43 return local == other.local;
Chris@16 44 }
Chris@16 45
Chris@16 46 bool operator<(serializable_local_descriptor const& other) const
Chris@16 47 {
Chris@16 48 return local < other.local;
Chris@16 49 }
Chris@16 50
Chris@16 51 template <class Archive>
Chris@16 52 void serialize(Archive& ar, const unsigned int /*version*/)
Chris@16 53 {
Chris@16 54 ar & unsafe_serialize(local);
Chris@16 55 }
Chris@16 56
Chris@16 57 Local local;
Chris@16 58 };
Chris@16 59
Chris@16 60 template <class Vertex, class Properties>
Chris@16 61 struct pending_edge
Chris@16 62 {
Chris@16 63 pending_edge(
Chris@16 64 Vertex source, Vertex target
Chris@16 65 , Properties properties, void* property_ptr
Chris@16 66 )
Chris@16 67 : source(source)
Chris@16 68 , target(target)
Chris@16 69 , properties(properties)
Chris@16 70 , property_ptr(property_ptr)
Chris@16 71 {}
Chris@16 72
Chris@16 73 Vertex source;
Chris@16 74 Vertex target;
Chris@16 75 Properties properties;
Chris@16 76 void* property_ptr;
Chris@16 77 };
Chris@16 78
Chris@16 79 inline bool is_digit(char c)
Chris@16 80 {
Chris@16 81 return (bool)std::isdigit(c);
Chris@16 82 }
Chris@16 83
Chris@16 84 inline std::vector<int>
Chris@16 85 available_process_files(std::string const& filename)
Chris@16 86 {
Chris@16 87 if (!filesystem::exists(filename))
Chris@16 88 return std::vector<int>();
Chris@16 89
Chris@16 90 std::vector<int> result;
Chris@16 91
Chris@16 92 for (filesystem::directory_iterator i(filename), end; i != end; ++i)
Chris@16 93 {
Chris@16 94 if (!filesystem::is_regular(*i))
Chris@16 95 boost::throw_exception(std::runtime_error("directory contains non-regular entries"));
Chris@16 96
Chris@16 97 std::string process_name = i->path().filename().string();
Chris@16 98 for (std::string::size_type i = 0; i < process_name.size(); ++i)
Chris@16 99 if (!is_digit(process_name[i]))
Chris@16 100 boost::throw_exception(std::runtime_error("directory contains files with invalid names"));
Chris@16 101
Chris@16 102 result.push_back(boost::lexical_cast<int>(process_name));
Chris@16 103 }
Chris@16 104
Chris@16 105 return result;
Chris@16 106 }
Chris@16 107
Chris@16 108 template <class Archive, class Tag, class T, class Base>
Chris@16 109 void maybe_load_properties(
Chris@16 110 Archive& ar, char const* name, property<Tag, T, Base>& properties)
Chris@16 111 {
Chris@16 112 ar >> serialization::make_nvp(name, get_property_value(properties, Tag()));
Chris@16 113 maybe_load_properties(ar, name, static_cast<Base&>(properties));
Chris@16 114 }
Chris@16 115
Chris@16 116 template <class Archive>
Chris@16 117 void maybe_load_properties(
Chris@16 118 Archive&, char const*, no_property&)
Chris@16 119 {}
Chris@16 120
Chris@16 121 template <class Archive, typename Bundle>
Chris@16 122 void maybe_load_properties(
Chris@16 123 Archive& ar, char const* name, Bundle& bundle)
Chris@16 124 {
Chris@16 125 ar >> serialization::make_nvp(name, bundle);
Chris@16 126 no_property prop;
Chris@16 127 maybe_load_properties(ar, name, prop);
Chris@16 128 }
Chris@16 129
Chris@16 130
Chris@16 131
Chris@16 132
Chris@16 133
Chris@16 134
Chris@16 135 template <class Graph, class Archive, class VertexListS>
Chris@16 136 struct graph_loader
Chris@16 137 {
Chris@16 138 typedef typename Graph::vertex_descriptor vertex_descriptor;
Chris@16 139 typedef typename Graph::local_vertex_descriptor local_vertex_descriptor;
Chris@16 140 typedef typename Graph::vertex_property_type vertex_property_type;
Chris@16 141 typedef typename Graph::edge_descriptor edge_descriptor;
Chris@16 142 typedef typename Graph::local_edge_descriptor local_edge_descriptor;
Chris@16 143 typedef typename Graph::edge_property_type edge_property_type;
Chris@16 144 typedef typename Graph::process_group_type process_group_type;
Chris@16 145 typedef typename process_group_type::process_id_type process_id_type;
Chris@16 146 typedef typename Graph::directed_selector directed_selector;
Chris@16 147 typedef typename mpl::if_<
Chris@16 148 is_same<VertexListS, defaultS>, vecS, VertexListS
Chris@16 149 >::type vertex_list_selector;
Chris@16 150 typedef pending_edge<vertex_descriptor, edge_property_type>
Chris@16 151 pending_edge_type;
Chris@16 152 typedef serializable_local_descriptor<local_vertex_descriptor>
Chris@16 153 serializable_vertex_descriptor;
Chris@16 154
Chris@16 155 graph_loader(Graph& g, Archive& ar)
Chris@16 156 : m_g(g)
Chris@16 157 , m_ar(ar)
Chris@16 158 , m_pg(g.process_group())
Chris@16 159 , m_requested_vertices(num_processes(m_pg))
Chris@16 160 , m_remote_vertices(num_processes(m_pg))
Chris@16 161 , m_property_ptrs(num_processes(m_pg))
Chris@16 162 {
Chris@16 163 g.clear();
Chris@16 164 load_prefix();
Chris@16 165 load_vertices();
Chris@16 166 load_edges();
Chris@16 167 ar >> make_nvp("distribution", m_g.distribution());
Chris@16 168 }
Chris@16 169
Chris@16 170 private:
Chris@16 171 struct pending_in_edge
Chris@16 172 {
Chris@16 173 pending_in_edge(
Chris@16 174 vertex_descriptor u, vertex_descriptor v, void* property_ptr
Chris@16 175 )
Chris@16 176 : u(u)
Chris@16 177 , v(v)
Chris@16 178 , property_ptr(property_ptr)
Chris@16 179 {}
Chris@16 180
Chris@16 181 vertex_descriptor u;
Chris@16 182 vertex_descriptor v;
Chris@16 183 void* property_ptr;
Chris@16 184 };
Chris@16 185
Chris@16 186 bool is_root() const
Chris@16 187 {
Chris@16 188 return process_id(m_pg) == 0;
Chris@16 189 }
Chris@16 190
Chris@16 191 template <class T>
Chris@16 192 serialization::nvp<T> const make_nvp(char const* name, T& value) const
Chris@16 193 {
Chris@16 194 return serialization::nvp<T>(name, value);
Chris@16 195 }
Chris@16 196
Chris@16 197 void load_prefix();
Chris@16 198 void load_vertices();
Chris@16 199
Chris@16 200 template <class Anything>
Chris@16 201 void maybe_load_and_store_local_vertex(Anything);
Chris@16 202 void maybe_load_and_store_local_vertex(vecS);
Chris@16 203
Chris@16 204 void load_edges();
Chris@16 205 void load_in_edges(bidirectionalS);
Chris@16 206 void load_in_edges(directedS);
Chris@16 207 void add_pending_in_edge(
Chris@16 208 vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS);
Chris@16 209 template <class Anything>
Chris@16 210 void add_pending_in_edge(
Chris@16 211 vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything);
Chris@16 212 template <class Anything>
Chris@16 213 void add_edge(
Chris@16 214 vertex_descriptor u, vertex_descriptor v
Chris@16 215 , edge_property_type const& property, void* property_ptr, Anything);
Chris@16 216 void add_edge(
Chris@16 217 vertex_descriptor u, vertex_descriptor v
Chris@16 218 , edge_property_type const& property, void* property_ptr, vecS);
Chris@16 219 void add_remote_vertex_request(
Chris@16 220 vertex_descriptor u, vertex_descriptor v, directedS);
Chris@16 221 void add_remote_vertex_request(
Chris@16 222 vertex_descriptor u, vertex_descriptor v, bidirectionalS);
Chris@16 223 void add_in_edge(
Chris@16 224 edge_descriptor const&, void*, directedS);
Chris@16 225 void add_in_edge(
Chris@16 226 edge_descriptor const& edge, void* old_property_ptr, bidirectionalS);
Chris@16 227
Chris@16 228 void resolve_remote_vertices(directedS);
Chris@16 229 void resolve_remote_vertices(bidirectionalS);
Chris@16 230 vertex_descriptor resolve_remote_vertex(vertex_descriptor u) const;
Chris@16 231 vertex_descriptor resolve_remote_vertex(vertex_descriptor u, vecS) const;
Chris@16 232 template <class Anything>
Chris@16 233 vertex_descriptor resolve_remote_vertex(vertex_descriptor u, Anything) const;
Chris@16 234
Chris@16 235 void resolve_property_ptrs();
Chris@16 236
Chris@16 237 void commit_pending_edges(vecS);
Chris@16 238 template <class Anything>
Chris@16 239 void commit_pending_edges(Anything);
Chris@16 240 void commit_pending_in_edges(directedS);
Chris@16 241 void commit_pending_in_edges(bidirectionalS);
Chris@16 242
Chris@16 243 void* maybe_load_property_ptr(directedS) { return 0; }
Chris@16 244 void* maybe_load_property_ptr(bidirectionalS);
Chris@16 245
Chris@16 246 Graph& m_g;
Chris@16 247 Archive& m_ar;
Chris@16 248 process_group_type m_pg;
Chris@16 249
Chris@16 250 std::vector<process_id_type> m_id_mapping;
Chris@16 251
Chris@16 252 // Maps local vertices as loaded from the archive to
Chris@16 253 // the ones actually added to the graph. Only used
Chris@16 254 // when !vecS.
Chris@16 255 std::map<local_vertex_descriptor, local_vertex_descriptor> m_local_vertices;
Chris@16 256
Chris@16 257 // This is the list of remote vertex descriptors that we
Chris@16 258 // are going to receive from other processes. This is
Chris@16 259 // kept sorted so that we can determine the position of
Chris@16 260 // the matching vertex descriptor in m_remote_vertices.
Chris@16 261 std::vector<std::vector<serializable_vertex_descriptor> > m_requested_vertices;
Chris@16 262
Chris@16 263 // This is the list of remote vertex descriptors that
Chris@16 264 // we send and receive from other processes.
Chris@16 265 std::vector<std::vector<serializable_vertex_descriptor> > m_remote_vertices;
Chris@16 266
Chris@16 267 // ...
Chris@16 268 std::vector<pending_edge_type> m_pending_edges;
Chris@16 269
Chris@16 270 // The pending in-edges that will be added in the commit step, after
Chris@16 271 // the remote vertex descriptors has been resolved. Only used
Chris@16 272 // when bidirectionalS and !vecS.
Chris@16 273 std::vector<pending_in_edge> m_pending_in_edges;
Chris@16 274
Chris@16 275 std::vector<std::vector<unsafe_pair<void*,void*> > > m_property_ptrs;
Chris@16 276 };
Chris@16 277
Chris@16 278 template <class Graph, class Archive, class VertexListS>
Chris@16 279 void graph_loader<Graph, Archive, VertexListS>::load_prefix()
Chris@16 280 {
Chris@16 281 typename process_group_type::process_size_type num_processes_;
Chris@16 282 m_ar >> make_nvp("num_processes", num_processes_);
Chris@16 283
Chris@16 284 if (num_processes_ != num_processes(m_pg))
Chris@16 285 boost::throw_exception(std::runtime_error("number of processes mismatch"));
Chris@16 286
Chris@16 287 process_id_type old_id;
Chris@16 288 m_ar >> make_nvp("id", old_id);
Chris@16 289
Chris@16 290 std::vector<typename Graph::distribution_type::size_type> mapping;
Chris@16 291 m_ar >> make_nvp("mapping", mapping);
Chris@16 292
Chris@16 293 // Fetch all the old id's from the other processes.
Chris@16 294 std::vector<process_id_type> old_ids;
Chris@16 295 all_gather(m_pg, &old_id, &old_id+1, old_ids);
Chris@16 296
Chris@16 297 m_id_mapping.resize(num_processes(m_pg), -1);
Chris@16 298
Chris@16 299 for (process_id_type i = 0; i < num_processes(m_pg); ++i)
Chris@16 300 {
Chris@16 301 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 302 if (is_root())
Chris@16 303 std::cout << i << " used to be " << old_ids[i] << "\n";
Chris@16 304 # endif
Chris@16 305 BOOST_ASSERT(m_id_mapping[old_ids[i]] == -1);
Chris@16 306 m_id_mapping[old_ids[i]] = i;
Chris@16 307 }
Chris@16 308
Chris@16 309 std::vector<typename Graph::distribution_type::size_type> new_mapping(
Chris@16 310 mapping.size());
Chris@16 311
Chris@16 312 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 313 {
Chris@16 314 new_mapping[mapping[old_ids[i]]] = i;
Chris@16 315 }
Chris@16 316
Chris@16 317 m_g.distribution().assign_mapping(
Chris@16 318 new_mapping.begin(), new_mapping.end());
Chris@16 319 }
Chris@16 320
Chris@16 321 template <class Graph, class Archive, class VertexListS>
Chris@16 322 void graph_loader<Graph, Archive, VertexListS>::load_vertices()
Chris@16 323 {
Chris@16 324 int V;
Chris@16 325 m_ar >> BOOST_SERIALIZATION_NVP(V);
Chris@16 326
Chris@16 327 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 328 if (is_root())
Chris@16 329 std::cout << "Loading vertices\n";
Chris@16 330 # endif
Chris@16 331
Chris@16 332 for (int i = 0; i < V; ++i)
Chris@16 333 {
Chris@16 334 maybe_load_and_store_local_vertex(vertex_list_selector());
Chris@16 335 }
Chris@16 336 }
Chris@16 337
Chris@16 338 template <class Graph, class Archive, class VertexListS>
Chris@16 339 template <class Anything>
Chris@16 340 void graph_loader<Graph, Archive, VertexListS>::maybe_load_and_store_local_vertex(Anything)
Chris@16 341 {
Chris@16 342 // Load the original vertex descriptor
Chris@16 343 local_vertex_descriptor local;
Chris@16 344 m_ar >> make_nvp("local", unsafe_serialize(local));
Chris@16 345
Chris@16 346 // Load the properties
Chris@16 347 vertex_property_type property;
Chris@16 348 detail::parallel::maybe_load_properties(m_ar, "vertex_property",
Chris@16 349 property);
Chris@16 350
Chris@16 351 // Add the vertex
Chris@16 352 vertex_descriptor v(process_id(m_pg), add_vertex(property, m_g.base()));
Chris@16 353
Chris@16 354 if (m_g.on_add_vertex)
Chris@16 355 m_g.on_add_vertex(v, m_g);
Chris@16 356
Chris@16 357 // Create the mapping from the "old" local descriptor to the new
Chris@16 358 // local descriptor.
Chris@16 359 m_local_vertices[local] = v.local;
Chris@16 360 }
Chris@16 361
Chris@16 362 template <class Graph, class Archive, class VertexListS>
Chris@16 363 void graph_loader<Graph, Archive, VertexListS>::maybe_load_and_store_local_vertex(vecS)
Chris@16 364 {
Chris@16 365 // Load the properties
Chris@16 366 vertex_property_type property;
Chris@16 367 detail::parallel::maybe_load_properties(m_ar, "vertex_property",
Chris@16 368 property);
Chris@16 369
Chris@16 370 // Add the vertex
Chris@16 371 vertex_descriptor v(process_id(m_pg),
Chris@16 372 add_vertex(m_g.build_vertex_property(property),
Chris@16 373 m_g.base()));
Chris@16 374
Chris@16 375 if (m_g.on_add_vertex)
Chris@16 376 m_g.on_add_vertex(v, m_g);
Chris@16 377 }
Chris@16 378
Chris@16 379 template <class Graph, class Archive, class VertexListS>
Chris@16 380 void graph_loader<Graph, Archive, VertexListS>::load_edges()
Chris@16 381 {
Chris@16 382 int E;
Chris@16 383 m_ar >> BOOST_SERIALIZATION_NVP(E);
Chris@16 384
Chris@16 385 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 386 if (is_root())
Chris@16 387 std::cout << "Loading edges\n";
Chris@16 388 # endif
Chris@16 389
Chris@16 390 for (int i = 0; i < E; ++i)
Chris@16 391 {
Chris@16 392 local_vertex_descriptor local_src;
Chris@16 393 process_id_type target_owner;
Chris@16 394 local_vertex_descriptor local_tgt;
Chris@16 395
Chris@16 396 m_ar >> make_nvp("source", unsafe_serialize(local_src));
Chris@16 397 m_ar >> make_nvp("target_owner", target_owner);
Chris@16 398 m_ar >> make_nvp("target", unsafe_serialize(local_tgt));
Chris@16 399
Chris@16 400 process_id_type new_src_owner = process_id(m_pg);
Chris@16 401 process_id_type new_tgt_owner = m_id_mapping[target_owner];
Chris@16 402
Chris@16 403 vertex_descriptor source(new_src_owner, local_src);
Chris@16 404 vertex_descriptor target(new_tgt_owner, local_tgt);
Chris@16 405
Chris@16 406 edge_property_type properties;
Chris@16 407 detail::parallel::maybe_load_properties(m_ar, "edge_property", properties);
Chris@16 408
Chris@16 409 void* property_ptr = maybe_load_property_ptr(directed_selector());
Chris@16 410 add_edge(source, target, properties, property_ptr, vertex_list_selector());
Chris@16 411 }
Chris@16 412
Chris@16 413 load_in_edges(directed_selector());
Chris@16 414 commit_pending_edges(vertex_list_selector());
Chris@16 415 }
Chris@16 416
Chris@16 417 template <class Graph, class Archive, class VertexListS>
Chris@16 418 void graph_loader<Graph, Archive, VertexListS>::load_in_edges(bidirectionalS)
Chris@16 419 {
Chris@16 420 std::size_t I;
Chris@16 421 m_ar >> BOOST_SERIALIZATION_NVP(I);
Chris@16 422
Chris@16 423 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 424 if (is_root())
Chris@16 425 std::cout << "Loading in-edges\n";
Chris@16 426 # endif
Chris@16 427
Chris@16 428 for (int i = 0; i < I; ++i)
Chris@16 429 {
Chris@16 430 process_id_type src_owner;
Chris@16 431 local_vertex_descriptor local_src;
Chris@16 432 local_vertex_descriptor local_target;
Chris@16 433 void* property_ptr;
Chris@16 434
Chris@16 435 m_ar >> make_nvp("src_owner", src_owner);
Chris@16 436 m_ar >> make_nvp("source", unsafe_serialize(local_src));
Chris@16 437 m_ar >> make_nvp("target", unsafe_serialize(local_target));
Chris@16 438 m_ar >> make_nvp("property_ptr", unsafe_serialize(property_ptr));
Chris@16 439
Chris@16 440 src_owner = m_id_mapping[src_owner];
Chris@16 441
Chris@16 442 vertex_descriptor u(src_owner, local_src);
Chris@16 443 vertex_descriptor v(process_id(m_pg), local_target);
Chris@16 444
Chris@16 445 add_pending_in_edge(u, v, property_ptr, vertex_list_selector());
Chris@16 446 }
Chris@16 447 }
Chris@16 448
Chris@16 449 template <class Graph, class Archive, class VertexListS>
Chris@16 450 void graph_loader<Graph, Archive, VertexListS>::load_in_edges(directedS)
Chris@16 451 {}
Chris@16 452
Chris@16 453 template <class Graph, class Archive, class VertexListS>
Chris@16 454 void graph_loader<Graph, Archive, VertexListS>::add_pending_in_edge(
Chris@16 455 vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS)
Chris@16 456 {
Chris@16 457 m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr));
Chris@16 458 }
Chris@16 459
Chris@16 460 template <class Graph, class Archive, class VertexListS>
Chris@16 461 template <class Anything>
Chris@16 462 void graph_loader<Graph, Archive, VertexListS>::add_pending_in_edge(
Chris@16 463 vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything)
Chris@16 464 {
Chris@16 465 // u and v represent the out-edge here, meaning v is local
Chris@16 466 // to us, and u is always remote.
Chris@16 467 m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr));
Chris@16 468 add_remote_vertex_request(v, u, bidirectionalS());
Chris@16 469 }
Chris@16 470
Chris@16 471 template <class Graph, class Archive, class VertexListS>
Chris@16 472 template <class Anything>
Chris@16 473 void graph_loader<Graph, Archive, VertexListS>::add_edge(
Chris@16 474 vertex_descriptor u, vertex_descriptor v
Chris@16 475 , edge_property_type const& property, void* property_ptr, Anything)
Chris@16 476 {
Chris@16 477 m_pending_edges.push_back(pending_edge_type(u, v, property, property_ptr));
Chris@16 478 add_remote_vertex_request(u, v, directed_selector());
Chris@16 479 }
Chris@16 480
Chris@16 481 template <class Graph, class Archive, class VertexListS>
Chris@16 482 void graph_loader<Graph, Archive, VertexListS>::add_remote_vertex_request(
Chris@16 483 vertex_descriptor u, vertex_descriptor v, directedS)
Chris@16 484 {
Chris@16 485 // We have to request the remote vertex.
Chris@16 486 m_requested_vertices[owner(v)].push_back(local(v));
Chris@16 487 }
Chris@16 488
Chris@16 489 template <class Graph, class Archive, class VertexListS>
Chris@16 490 void graph_loader<Graph, Archive, VertexListS>::add_remote_vertex_request(
Chris@16 491 vertex_descriptor u, vertex_descriptor v, bidirectionalS)
Chris@16 492 {
Chris@16 493 // If the edge spans to another process, we know
Chris@16 494 // that that process has a matching in-edge, so
Chris@16 495 // we can just send our vertex. No requests
Chris@16 496 // necessary.
Chris@16 497 if (owner(v) != m_g.processor())
Chris@16 498 {
Chris@16 499 m_remote_vertices[owner(v)].push_back(local(u));
Chris@16 500 m_requested_vertices[owner(v)].push_back(local(v));
Chris@16 501 }
Chris@16 502 }
Chris@16 503
Chris@16 504 template <class Graph, class Archive, class VertexListS>
Chris@16 505 void graph_loader<Graph, Archive, VertexListS>::add_edge(
Chris@16 506 vertex_descriptor u, vertex_descriptor v
Chris@16 507 , edge_property_type const& property, void* property_ptr, vecS)
Chris@16 508 {
Chris@16 509 std::pair<local_edge_descriptor, bool> inserted =
Chris@16 510 detail::parallel::add_local_edge(
Chris@16 511 local(u), local(v)
Chris@16 512 , m_g.build_edge_property(property), m_g.base());
Chris@16 513 BOOST_ASSERT(inserted.second);
Chris@16 514 put(edge_target_processor_id, m_g.base(), inserted.first, owner(v));
Chris@16 515
Chris@16 516 edge_descriptor e(owner(u), owner(v), true, inserted.first);
Chris@16 517
Chris@16 518 if (inserted.second && m_g.on_add_edge)
Chris@16 519 m_g.on_add_edge(e, m_g);
Chris@16 520
Chris@16 521 add_in_edge(e, property_ptr, directed_selector());
Chris@16 522 }
Chris@16 523
Chris@16 524 template <class Graph, class Archive, class VertexListS>
Chris@16 525 void graph_loader<Graph, Archive, VertexListS>::add_in_edge(
Chris@16 526 edge_descriptor const&, void*, directedS)
Chris@16 527 {}
Chris@16 528
Chris@16 529 template <class Graph, class Archive, class VertexListS>
Chris@16 530 void graph_loader<Graph, Archive, VertexListS>::add_in_edge(
Chris@16 531 edge_descriptor const& edge, void* old_property_ptr, bidirectionalS)
Chris@16 532 {
Chris@16 533 if (owner(target(edge, m_g)) == m_g.processor())
Chris@16 534 {
Chris@16 535 detail::parallel::stored_in_edge<local_edge_descriptor>
Chris@16 536 e(m_g.processor(), local(edge));
Chris@16 537 boost::graph_detail::push(get(
Chris@16 538 vertex_in_edges, m_g.base())[local(target(edge, m_g))], e);
Chris@16 539 }
Chris@16 540 else
Chris@16 541 {
Chris@16 542 // We send the (old,new) property pointer pair to
Chris@16 543 // the remote process. This could be optimized to
Chris@16 544 // only send the new one -- the ordering can be
Chris@16 545 // made implicit because the old pointer value is
Chris@16 546 // stored on the remote process.
Chris@16 547 //
Chris@16 548 // Doing that is a little bit more complicated, but
Chris@16 549 // in case it turns out it's important we can do it.
Chris@16 550 void* property_ptr = local(edge).get_property();
Chris@16 551 m_property_ptrs[owner(target(edge, m_g))].push_back(
Chris@16 552 unsafe_pair<void*,void*>(old_property_ptr, property_ptr));
Chris@16 553 }
Chris@16 554 }
Chris@16 555
Chris@16 556 template <class Graph, class Archive, class VertexListS>
Chris@16 557 void graph_loader<Graph, Archive, VertexListS>::resolve_property_ptrs()
Chris@16 558 {
Chris@16 559 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 560 if (is_root())
Chris@16 561 std::cout << "Resolving property pointers\n";
Chris@16 562 # endif
Chris@16 563
Chris@16 564 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 565 {
Chris@16 566 std::sort(
Chris@16 567 m_property_ptrs[i].begin(), m_property_ptrs[i].end());
Chris@16 568 }
Chris@16 569
Chris@16 570 boost::parallel::inplace_all_to_all(m_pg, m_property_ptrs);
Chris@16 571 }
Chris@16 572
Chris@16 573 template <class Graph, class Archive, class VertexListS>
Chris@16 574 void graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertices(directedS)
Chris@16 575 {
Chris@16 576 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 577 {
Chris@16 578 std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end());
Chris@16 579 }
Chris@16 580
Chris@16 581 boost::parallel::inplace_all_to_all(
Chris@16 582 m_pg, m_requested_vertices, m_remote_vertices);
Chris@16 583
Chris@16 584 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 585 {
Chris@16 586 BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i])
Chris@16 587 {
Chris@16 588 u = m_local_vertices[u];
Chris@16 589 }
Chris@16 590 }
Chris@16 591
Chris@16 592 boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices);
Chris@16 593 }
Chris@16 594
Chris@16 595 template <class Graph, class Archive, class VertexListS>
Chris@16 596 void graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertices(bidirectionalS)
Chris@16 597 {
Chris@16 598 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 599 if (is_root())
Chris@16 600 std::cout << "Resolving remote vertices\n";
Chris@16 601 # endif
Chris@16 602
Chris@16 603 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 604 {
Chris@16 605 std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end());
Chris@16 606 std::sort(m_remote_vertices[i].begin(), m_remote_vertices[i].end());
Chris@16 607
Chris@16 608 BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i])
Chris@16 609 {
Chris@16 610 u = m_local_vertices[u];
Chris@16 611 }
Chris@16 612 }
Chris@16 613
Chris@16 614 boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices);
Chris@16 615
Chris@16 616 for (int i = 0; i < num_processes(m_pg); ++i)
Chris@16 617 BOOST_ASSERT(m_remote_vertices[i].size() == m_requested_vertices[i].size());
Chris@16 618 }
Chris@16 619
Chris@16 620 template <class Graph, class Archive, class VertexListS>
Chris@16 621 void graph_loader<Graph, Archive, VertexListS>::commit_pending_edges(vecS)
Chris@16 622 {
Chris@16 623 commit_pending_in_edges(directed_selector());
Chris@16 624 }
Chris@16 625
Chris@16 626 template <class Graph, class Archive, class VertexListS>
Chris@16 627 template <class Anything>
Chris@16 628 void graph_loader<Graph, Archive, VertexListS>::commit_pending_edges(Anything)
Chris@16 629 {
Chris@16 630 resolve_remote_vertices(directed_selector());
Chris@16 631
Chris@16 632 BOOST_FOREACH(pending_edge_type const& e, m_pending_edges)
Chris@16 633 {
Chris@16 634 vertex_descriptor u = resolve_remote_vertex(e.source);
Chris@16 635 vertex_descriptor v = resolve_remote_vertex(e.target);
Chris@16 636 add_edge(u, v, e.properties, e.property_ptr, vecS());
Chris@16 637 }
Chris@16 638
Chris@16 639 commit_pending_in_edges(directed_selector());
Chris@16 640 }
Chris@16 641
Chris@16 642 template <class Graph, class Archive, class VertexListS>
Chris@16 643 void graph_loader<Graph, Archive, VertexListS>::commit_pending_in_edges(directedS)
Chris@16 644 {}
Chris@16 645
Chris@16 646 template <class Graph, class Archive, class VertexListS>
Chris@16 647 void graph_loader<Graph, Archive, VertexListS>::commit_pending_in_edges(bidirectionalS)
Chris@16 648 {
Chris@16 649 resolve_property_ptrs();
Chris@16 650
Chris@16 651 BOOST_FOREACH(pending_in_edge const& e, m_pending_in_edges)
Chris@16 652 {
Chris@16 653 vertex_descriptor u = resolve_remote_vertex(e.u, vertex_list_selector());
Chris@16 654 vertex_descriptor v = resolve_remote_vertex(e.v, vertex_list_selector());
Chris@16 655
Chris@16 656 typedef detail::parallel::stored_in_edge<local_edge_descriptor> stored_edge;
Chris@16 657
Chris@16 658 std::vector<unsafe_pair<void*,void*> >::iterator i = std::lower_bound(
Chris@16 659 m_property_ptrs[owner(u)].begin()
Chris@16 660 , m_property_ptrs[owner(u)].end()
Chris@16 661 , unsafe_pair<void*,void*>(e.property_ptr, 0)
Chris@16 662 );
Chris@16 663
Chris@16 664 if (i == m_property_ptrs[owner(u)].end()
Chris@16 665 || i->first != e.property_ptr)
Chris@16 666 {
Chris@16 667 BOOST_ASSERT(false);
Chris@16 668 }
Chris@16 669
Chris@16 670 local_edge_descriptor local_edge(local(u), local(v), i->second);
Chris@16 671 stored_edge edge(owner(u), local_edge);
Chris@16 672 boost::graph_detail::push(
Chris@16 673 get(vertex_in_edges, m_g.base())[local(v)], edge);
Chris@16 674 }
Chris@16 675 }
Chris@16 676
Chris@16 677 template <class Graph, class Archive, class VertexListS>
Chris@16 678 typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor
Chris@16 679 graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex(
Chris@16 680 vertex_descriptor u) const
Chris@16 681 {
Chris@16 682 if (owner(u) == process_id(m_pg))
Chris@16 683 {
Chris@16 684 return vertex_descriptor(
Chris@16 685 process_id(m_pg), m_local_vertices.find(local(u))->second);
Chris@16 686 }
Chris@16 687
Chris@16 688 typename std::vector<serializable_vertex_descriptor>::const_iterator
Chris@16 689 i = std::lower_bound(
Chris@16 690 m_requested_vertices[owner(u)].begin()
Chris@16 691 , m_requested_vertices[owner(u)].end()
Chris@16 692 , serializable_vertex_descriptor(local(u))
Chris@16 693 );
Chris@16 694
Chris@16 695 if (i == m_requested_vertices[owner(u)].end()
Chris@16 696 || *i != local(u))
Chris@16 697 {
Chris@16 698 BOOST_ASSERT(false);
Chris@16 699 }
Chris@16 700
Chris@16 701 local_vertex_descriptor local =
Chris@16 702 m_remote_vertices[owner(u)][m_requested_vertices[owner(u)].end() - i];
Chris@16 703 return vertex_descriptor(owner(u), local);
Chris@16 704 }
Chris@16 705
Chris@16 706 template <class Graph, class Archive, class VertexListS>
Chris@16 707 typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor
Chris@16 708 graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex(
Chris@16 709 vertex_descriptor u, vecS) const
Chris@16 710 {
Chris@16 711 return u;
Chris@16 712 }
Chris@16 713
Chris@16 714 template <class Graph, class Archive, class VertexListS>
Chris@16 715 template <class Anything>
Chris@16 716 typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor
Chris@16 717 graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex(
Chris@16 718 vertex_descriptor u, Anything) const
Chris@16 719 {
Chris@16 720 return resolve_remote_vertex(u);
Chris@16 721 }
Chris@16 722
Chris@16 723 template <class Graph, class Archive, class VertexListS>
Chris@16 724 void*
Chris@16 725 graph_loader<Graph, Archive, VertexListS>::maybe_load_property_ptr(bidirectionalS)
Chris@16 726 {
Chris@16 727 void* ptr;
Chris@16 728 m_ar >> make_nvp("property_ptr", unsafe_serialize(ptr));
Chris@16 729 return ptr;
Chris@16 730 }
Chris@16 731
Chris@16 732 template <class Archive, class D>
Chris@16 733 void maybe_save_local_descriptor(Archive& ar, D const&, vecS)
Chris@16 734 {}
Chris@16 735
Chris@16 736 template <class Archive, class D, class NotVecS>
Chris@16 737 void maybe_save_local_descriptor(Archive& ar, D const& d, NotVecS)
Chris@16 738 {
Chris@16 739 ar << serialization::make_nvp(
Chris@16 740 "local", unsafe_serialize(const_cast<D&>(d)));
Chris@16 741 }
Chris@16 742
Chris@16 743 template <class Archive>
Chris@16 744 void maybe_save_properties(
Chris@16 745 Archive&, char const*, no_property const&)
Chris@16 746 {}
Chris@16 747
Chris@16 748 template <class Archive, class Tag, class T, class Base>
Chris@16 749 void maybe_save_properties(
Chris@16 750 Archive& ar, char const* name, property<Tag, T, Base> const& properties)
Chris@16 751 {
Chris@16 752 ar & serialization::make_nvp(name, get_property_value(properties, Tag()));
Chris@16 753 maybe_save_properties(ar, name, static_cast<Base const&>(properties));
Chris@16 754 }
Chris@16 755
Chris@16 756 template <class Archive, class Graph>
Chris@16 757 void save_in_edges(Archive& ar, Graph const& g, directedS)
Chris@16 758 {}
Chris@16 759
Chris@16 760 // We need to save the edges in the base edge
Chris@16 761 // list, and the in_edges that are stored in the
Chris@16 762 // vertex_in_edges vertex property.
Chris@16 763 template <class Archive, class Graph>
Chris@16 764 void save_in_edges(Archive& ar, Graph const& g, bidirectionalS)
Chris@16 765 {
Chris@16 766 typedef typename Graph::process_group_type
Chris@16 767 process_group_type;
Chris@16 768 typedef typename process_group_type::process_id_type
Chris@16 769 process_id_type;
Chris@16 770 typedef typename graph_traits<
Chris@16 771 Graph>::vertex_descriptor vertex_descriptor;
Chris@16 772 typedef typename vertex_descriptor::local_descriptor_type
Chris@16 773 local_vertex_descriptor;
Chris@16 774 typedef typename graph_traits<
Chris@16 775 Graph>::edge_descriptor edge_descriptor;
Chris@16 776
Chris@16 777 process_id_type id = g.processor();
Chris@16 778
Chris@16 779 std::vector<edge_descriptor> saved_in_edges;
Chris@16 780
Chris@16 781 BGL_FORALL_VERTICES_T(v, g, Graph)
Chris@16 782 {
Chris@16 783 BOOST_FOREACH(edge_descriptor const& e, in_edges(v, g))
Chris@16 784 {
Chris@16 785 // Only save the in_edges that isn't owned by this process.
Chris@16 786 if (owner(e) == id)
Chris@16 787 continue;
Chris@16 788
Chris@16 789 saved_in_edges.push_back(e);
Chris@16 790 }
Chris@16 791 }
Chris@16 792
Chris@16 793 std::size_t I = saved_in_edges.size();
Chris@16 794 ar << BOOST_SERIALIZATION_NVP(I);
Chris@16 795
Chris@16 796 BOOST_FOREACH(edge_descriptor const& e, saved_in_edges)
Chris@16 797 {
Chris@16 798 process_id_type src_owner = owner(source(e,g));
Chris@16 799 local_vertex_descriptor local_src = local(source(e,g));
Chris@16 800 local_vertex_descriptor local_target = local(target(e,g));
Chris@16 801 void* property_ptr = local(e).get_property();
Chris@16 802
Chris@16 803 using serialization::make_nvp;
Chris@16 804
Chris@16 805 ar << make_nvp("src_owner", src_owner);
Chris@16 806 ar << make_nvp("source", unsafe_serialize(local_src));
Chris@16 807 ar << make_nvp("target", unsafe_serialize(local_target));
Chris@16 808 ar << make_nvp("property_ptr", unsafe_serialize(property_ptr));
Chris@16 809 }
Chris@16 810 }
Chris@16 811
Chris@16 812 template <class Archive, class Edge>
Chris@16 813 void maybe_save_property_ptr(Archive&, Edge const&, directedS)
Chris@16 814 {}
Chris@16 815
Chris@16 816 template <class Archive, class Edge>
Chris@16 817 void maybe_save_property_ptr(Archive& ar, Edge const& e, bidirectionalS)
Chris@16 818 {
Chris@16 819 void* ptr = local(e).get_property();
Chris@16 820 ar << serialization::make_nvp("property_ptr", unsafe_serialize(ptr));
Chris@16 821 }
Chris@16 822
Chris@16 823 template <class Archive, class Graph, class DirectedS>
Chris@16 824 void save_edges(Archive& ar, Graph const& g, DirectedS)
Chris@16 825 {
Chris@16 826 typedef typename Graph::process_group_type
Chris@16 827 process_group_type;
Chris@16 828 typedef typename process_group_type::process_id_type
Chris@16 829 process_id_type;
Chris@16 830 typedef typename graph_traits<
Chris@16 831 Graph>::vertex_descriptor vertex_descriptor;
Chris@16 832
Chris@16 833 typedef typename Graph::edge_property_type edge_property_type;
Chris@16 834
Chris@16 835 int E = num_edges(g);
Chris@16 836 ar << BOOST_SERIALIZATION_NVP(E);
Chris@16 837
Chris@16 838 // For *directed* graphs, we can just save
Chris@16 839 // the edge list and be done.
Chris@16 840 //
Chris@16 841 // For *bidirectional* graphs, we need to also
Chris@16 842 // save the "vertex_in_edges" property map,
Chris@16 843 // because it might contain in-edges that
Chris@16 844 // are not locally owned.
Chris@16 845 BGL_FORALL_EDGES_T(e, g, Graph)
Chris@16 846 {
Chris@16 847 vertex_descriptor src(source(e, g));
Chris@16 848 vertex_descriptor tgt(target(e, g));
Chris@16 849
Chris@16 850 typename vertex_descriptor::local_descriptor_type
Chris@16 851 local_u(local(src));
Chris@16 852 typename vertex_descriptor::local_descriptor_type
Chris@16 853 local_v(local(tgt));
Chris@16 854
Chris@16 855 process_id_type target_owner = owner(tgt);
Chris@16 856
Chris@16 857 using serialization::make_nvp;
Chris@16 858
Chris@16 859 ar << make_nvp("source", unsafe_serialize(local_u));
Chris@16 860 ar << make_nvp("target_owner", target_owner);
Chris@16 861 ar << make_nvp("target", unsafe_serialize(local_v));
Chris@16 862
Chris@16 863 maybe_save_properties(
Chris@16 864 ar, "edge_property"
Chris@16 865 , static_cast<edge_property_type const&>(get(edge_all_t(), g, e))
Chris@16 866 );
Chris@16 867
Chris@16 868 maybe_save_property_ptr(ar, e, DirectedS());
Chris@16 869 }
Chris@16 870
Chris@16 871 save_in_edges(ar, g, DirectedS());
Chris@16 872 }
Chris@16 873
Chris@16 874 }} // namespace detail::parallel
Chris@16 875
Chris@16 876 template <PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 877 template <class IStreamConstructibleArchive>
Chris@16 878 void PBGL_DISTRIB_ADJLIST_TYPE::load(std::string const& filename)
Chris@16 879 {
Chris@16 880 process_group_type pg = process_group();
Chris@16 881 process_id_type id = process_id(pg);
Chris@16 882
Chris@16 883 synchronize(pg);
Chris@16 884
Chris@16 885 std::vector<int> disk_files = detail::parallel::available_process_files(filename);
Chris@16 886 std::sort(disk_files.begin(), disk_files.end());
Chris@16 887
Chris@16 888 // Negotiate which process gets which file. Serialized.
Chris@16 889 std::vector<int> consumed_files;
Chris@16 890 int picked_file = -1;
Chris@16 891
Chris@16 892 if (id > 0)
Chris@16 893 receive_oob(pg, id-1, 0, consumed_files);
Chris@16 894
Chris@16 895 std::sort(consumed_files.begin(), consumed_files.end());
Chris@16 896 std::vector<int> available_files;
Chris@16 897 std::set_difference(
Chris@16 898 disk_files.begin(), disk_files.end()
Chris@16 899 , consumed_files.begin(), consumed_files.end()
Chris@16 900 , std::back_inserter(available_files)
Chris@16 901 );
Chris@16 902
Chris@16 903 if (available_files.empty())
Chris@16 904 boost::throw_exception(std::runtime_error("no file available"));
Chris@16 905
Chris@16 906 // back() used for debug purposes. Making sure the
Chris@16 907 // ranks are shuffled.
Chris@16 908 picked_file = available_files.back();
Chris@16 909
Chris@16 910 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 911 std::cout << id << " picked " << picked_file << "\n";
Chris@16 912 # endif
Chris@16 913
Chris@16 914 consumed_files.push_back(picked_file);
Chris@16 915
Chris@16 916 if (id < num_processes(pg) - 1)
Chris@16 917 send_oob(pg, id+1, 0, consumed_files);
Chris@16 918
Chris@16 919 std::string local_filename = filename + "/" +
Chris@16 920 lexical_cast<std::string>(picked_file);
Chris@16 921
Chris@16 922 std::ifstream in(local_filename.c_str(), std::ios_base::binary);
Chris@16 923 IStreamConstructibleArchive ar(in);
Chris@16 924
Chris@16 925 detail::parallel::graph_loader<
Chris@16 926 graph_type, IStreamConstructibleArchive, InVertexListS
Chris@16 927 > loader(*this, ar);
Chris@16 928
Chris@16 929 # ifdef PBGL_SERIALIZE_DEBUG
Chris@16 930 std::cout << "Process " << id << " done loading.\n";
Chris@16 931 # endif
Chris@16 932
Chris@16 933 synchronize(pg);
Chris@16 934 }
Chris@16 935
Chris@16 936 template <PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS>
Chris@16 937 template <class OStreamConstructibleArchive>
Chris@16 938 void PBGL_DISTRIB_ADJLIST_TYPE::save(std::string const& filename) const
Chris@16 939 {
Chris@16 940 typedef typename config_type::VertexListS vertex_list_selector;
Chris@16 941
Chris@16 942 process_group_type pg = process_group();
Chris@16 943 process_id_type id = process_id(pg);
Chris@16 944
Chris@16 945 if (filesystem::exists(filename) && !filesystem::is_directory(filename))
Chris@16 946 boost::throw_exception(std::runtime_error("entry exists, but is not a directory"));
Chris@16 947
Chris@16 948 filesystem::remove_all(filename);
Chris@16 949 filesystem::create_directory(filename);
Chris@16 950
Chris@16 951 synchronize(pg);
Chris@16 952
Chris@16 953 std::string local_filename = filename + "/" +
Chris@16 954 lexical_cast<std::string>(id);
Chris@16 955
Chris@16 956 std::ofstream out(local_filename.c_str(), std::ios_base::binary);
Chris@16 957 OStreamConstructibleArchive ar(out);
Chris@16 958
Chris@16 959 using serialization::make_nvp;
Chris@16 960
Chris@16 961 typename process_group_type::process_size_type num_processes_ = num_processes(pg);
Chris@16 962 ar << make_nvp("num_processes", num_processes_);
Chris@16 963 ar << BOOST_SERIALIZATION_NVP(id);
Chris@16 964 ar << make_nvp("mapping", this->distribution().mapping());
Chris@16 965
Chris@16 966 int V = num_vertices(*this);
Chris@16 967 ar << BOOST_SERIALIZATION_NVP(V);
Chris@16 968
Chris@16 969 BGL_FORALL_VERTICES_T(v, *this, graph_type)
Chris@16 970 {
Chris@16 971 local_vertex_descriptor local_descriptor(local(v));
Chris@16 972 detail::parallel::maybe_save_local_descriptor(
Chris@16 973 ar, local_descriptor, vertex_list_selector());
Chris@16 974 detail::parallel::maybe_save_properties(
Chris@16 975 ar, "vertex_property"
Chris@16 976 , static_cast<vertex_property_type const&>(get(vertex_all_t(), *this, v))
Chris@16 977 );
Chris@16 978 }
Chris@16 979
Chris@16 980 detail::parallel::save_edges(ar, *this, directed_selector());
Chris@16 981
Chris@16 982 ar << make_nvp("distribution", this->distribution());
Chris@16 983 }
Chris@16 984
Chris@16 985 } // namespace boost
Chris@16 986
Chris@16 987 #endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP
Chris@16 988