Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions include/boost/graph/distributed/detail/property_serialize.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright (C) Jeremy Siek 2006.
// Copyright (C) 2026 Arnaud Becheler.

// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// Serialization traits for boost::property<> and boost::no_property when a
// Parallel BGL adjacency_list is sent over MPI.

#ifndef BOOST_GRAPH_DISTRIBUTED_DETAIL_PROPERTY_SERIALIZE_HPP
#define BOOST_GRAPH_DISTRIBUTED_DETAIL_PROPERTY_SERIALIZE_HPP

#include <boost/pending/property.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/int.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/level.hpp>
#include <boost/serialization/tracking.hpp>

// Setting the serialization properties of boost::property<> and
// boost::no_property to is_bitwise_serializable, object_serializable,
// track_never only when BOOST_GRAPH_USE_MPI is defined is dubious.
//
// This changes the serialization format of these classes, and hence
// of boost::adjacency_list, depending on whether BOOST_GRAPH_USE_MPI
// is defined.
//
// These serialization properties should probably be set in either case.
//
// Unfortunately, doing that now will change the serialization format
// of boost::adjacency_list in the non-MPI case, and could potentially
// break software that reads files serialized with an older release.

namespace boost
{

namespace mpi
{

// forward declaration, to avoid including mpi
template < typename T > struct is_mpi_datatype;

template < typename Tag, typename T, typename Base >
struct is_mpi_datatype< property< Tag, T, Base > >
: mpl::and_< is_mpi_datatype< T >, is_mpi_datatype< Base > >
{
};
}

namespace serialization
{
template < typename Tag, typename T, typename Base >
struct is_bitwise_serializable< property< Tag, T, Base > >
: mpl::and_< is_bitwise_serializable< T >, is_bitwise_serializable< Base > >
{
};

template < typename Tag, typename T, typename Base >
struct implementation_level< property< Tag, T, Base > >
: mpl::int_< object_serializable >
{
};

template < typename Tag, typename T, typename Base >
struct tracking_level< property< Tag, T, Base > > : mpl::int_< track_never >
{
};

}

namespace mpi
{
template <> struct is_mpi_datatype< boost::no_property > : mpl::true_
{
};
}

} // end namespace boost

BOOST_IS_BITWISE_SERIALIZABLE(boost::no_property)
BOOST_CLASS_IMPLEMENTATION(boost::no_property, object_serializable)
BOOST_CLASS_TRACKING(boost::no_property, track_never)

#endif // BOOST_GRAPH_DISTRIBUTED_DETAIL_PROPERTY_SERIALIZE_HPP
1 change: 1 addition & 0 deletions include/boost/graph/distributed/filtered_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#endif

#include <boost/graph/parallel/process_group.hpp>
#include <boost/graph/parallel/container_traits.hpp>
#include <boost/graph/filtered_graph.hpp>

namespace boost {
Expand Down
1 change: 1 addition & 0 deletions include/boost/graph/distributed/fruchterman_reingold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#endif

#include <boost/graph/fruchterman_reingold.hpp>
#include <boost/graph/point_traits.hpp>

namespace boost { namespace graph { namespace distributed {

Expand Down
1 change: 1 addition & 0 deletions include/boost/graph/distributed/rmat_graph_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <boost/assert.hpp>
#include <boost/graph/parallel/algorithm.hpp>
#include <boost/graph/parallel/process_group.hpp>
#include <boost/graph/graph_traits.hpp>
#include <math.h>

namespace boost {
Expand Down
1 change: 1 addition & 0 deletions include/boost/graph/distributed/strong_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <boost/graph/distributed/filtered_graph.hpp>
#include <boost/pending/indirect_cmp.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/overloading.hpp>
#include <boost/graph/distributed/concepts.hpp>
Expand Down
53 changes: 53 additions & 0 deletions include/boost/graph/use_mpi.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (C) 2004-2009 The Trustees of Indiana University.
// Copyright (C) 2026 Arnaud Becheler.

// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// Authors: Nick Edmonds
// Andrew Lumsdaine

#ifndef BOOST_GRAPH_USE_MPI_HPP
#define BOOST_GRAPH_USE_MPI_HPP

#define BOOST_GRAPH_USE_MPI

#include <boost/mpl/bool.hpp>

namespace boost
{
template < typename G > struct graph_traits;
template < typename T, typename Tag, typename Base > struct bgl_named_params;

namespace detail
{
// Declared before breadth_first_search.hpp so bfs_dispatch finds it by
// ordinary lookup. Defined in distributed/breadth_first_search.hpp.
template < class DistributedGraph, class ColorMap, class BFSVisitor,
class P, class T, class R >
void bfs_helper(DistributedGraph& g,
typename graph_traits< DistributedGraph >::vertex_descriptor s,
ColorMap color, BFSVisitor vis,
const bgl_named_params< P, T, R >& params, boost::mpl::true_);
}
}

// property<> serialization traits, needed wherever MPI serialization happens.
#include <boost/graph/distributed/detail/property_serialize.hpp>

// Distributed algorithm overloads.
#include <boost/graph/distributed/concepts.hpp>
#include <boost/graph/distributed/breadth_first_search.hpp>
#include <boost/graph/distributed/connected_components.hpp>
#include <boost/graph/distributed/depth_first_search.hpp>
#include <boost/graph/distributed/dijkstra_shortest_paths.hpp>
#include <boost/graph/distributed/strong_components.hpp>
#include <boost/graph/distributed/page_rank.hpp>
#include <boost/graph/distributed/fruchterman_reingold.hpp>
#include <boost/graph/distributed/rmat_graph_generator.hpp>
#include <boost/graph/distributed/one_bit_color_map.hpp>
#include <boost/graph/distributed/two_bit_color_map.hpp>
#include <boost/graph/distributed/graphviz.hpp>

#endif // BOOST_GRAPH_USE_MPI_HPP
Loading