diff --git a/include/boost/graph/distributed/adjacency_list.hpp b/include/boost/graph/distributed/adjacency_list.hpp index 8c01c53..327d952 100644 --- a/include/boost/graph/distributed/adjacency_list.hpp +++ b/include/boost/graph/distributed/adjacency_list.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -966,7 +966,7 @@ namespace boost { && i->e == e.local) ++i; - assert(i != in_edges.end()); + BOOST_ASSERT(i != in_edges.end()); in_edges.erase(i); } @@ -1692,25 +1692,25 @@ namespace boost { // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) { - assert(v.owner == processor()); + BOOST_ASSERT(v.owner == processor()); return base()[v.local]; } const vertex_bundled& operator[](vertex_descriptor v) const { - assert(v.owner == processor()); + BOOST_ASSERT(v.owner == processor()); return base()[v.local]; } edge_bundled& operator[](edge_descriptor e) { - assert(e.owner() == processor()); + BOOST_ASSERT(e.owner() == processor()); return base()[e.local]; } const edge_bundled& operator[](edge_descriptor e) const { - assert(e.owner() == processor()); + BOOST_ASSERT(e.owner() == processor()); return base()[e.local]; } @@ -2078,7 +2078,7 @@ namespace boost { detail::parallel::add_local_edge(target(data.e, base()), source(data.e, base()), build_edge_property(data.get_property()), base()); - assert(edge.second); + BOOST_ASSERT(edge.second); put(edge_target_processor_id, base(), edge.first, other_proc); if (edge.second && on_add_edge) @@ -2119,7 +2119,7 @@ namespace boost { remove_local_edge_from_list(src, tgt, undirectedS()); } else { - assert(tgt.owner == process_id(process_group_)); + BOOST_ASSERT(tgt.owner == process_id(process_group_)); in_edge_list_type& in_edges = get(vertex_in_edges, base())[tgt.local]; typename in_edge_list_type::iterator ei; @@ -2287,7 +2287,7 @@ namespace boost { PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property:: commit() const { - assert(!this->committed); + BOOST_ASSERT(!this->committed); this->committed = true; process_id_type owner @@ -2391,7 +2391,7 @@ namespace boost { std::pair PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge::commit() const { - assert(!committed); + BOOST_ASSERT(!committed); committed = true; if (source.owner == self.processor()) @@ -2583,7 +2583,7 @@ namespace boost { PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property:: commit() const { - assert(!this->committed); + BOOST_ASSERT(!this->committed); this->committed = true; if (this->source.owner == this->self.processor()) @@ -2683,7 +2683,7 @@ namespace boost { out_edges(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); typedef PBGL_DISTRIB_ADJLIST_TYPE impl; typedef typename impl::out_edge_generator generator; @@ -2705,7 +2705,7 @@ namespace boost { out_degree(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); return out_degree(v.local, g.base()); } @@ -2727,7 +2727,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) impl; typedef typename impl::inherited base_graph_type; @@ -2755,7 +2755,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) impl; typedef typename impl::in_edge_generator generator; @@ -2778,7 +2778,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); return get(vertex_in_edges, g.base())[v.local].size(); } @@ -2792,7 +2792,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); return out_degree(v.local, g.base()); } @@ -2809,7 +2809,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); return out_degree(v.local, g.base()); } @@ -2823,7 +2823,7 @@ namespace boost { ::vertex_descriptor v, const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) { - assert(v.owner == g.processor()); + BOOST_ASSERT(v.owner == g.processor()); return out_degree(v, g) + in_degree(v, g); } @@ -2893,7 +2893,7 @@ namespace boost { ::edge_descriptor edge_descriptor; // For directed graphs, u must be local - assert(u.owner == process_id(g.process_group())); + BOOST_ASSERT(u.owner == process_id(g.process_group())); typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) ::out_edge_iterator ei, ei_end; @@ -2930,7 +2930,7 @@ namespace boost { } return std::make_pair(edge_descriptor(), false); } else { - assert(false); + BOOST_ASSERT(false); exit(1); } } @@ -2997,8 +2997,8 @@ namespace boost { remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor e, PBGL_DISTRIB_ADJLIST_TYPE& g) { - assert(source(e, g).owner == g.processor() - || target(e, g).owner == g.processor()); + BOOST_ASSERT(source(e, g).owner == g.processor() + || target(e, g).owner == g.processor()); if (target(e, g).owner == g.processor()) detail::parallel::remove_in_edge(e, g, DirectedS()); @@ -3042,7 +3042,7 @@ namespace boost { ::out_edge_iterator ei, PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) { - assert(source(*ei, g).owner == g.processor()); + BOOST_ASSERT(source(*ei, g).owner == g.processor()); remove_edge(ei->local, g.base()); } @@ -3108,7 +3108,7 @@ namespace boost { typedef parallel::detail::remove_out_edge_predicate Pred; - assert(u.owner == g.processor()); + BOOST_ASSERT(u.owner == g.processor()); remove_out_edge_if(u.local, Pred(g, predicate), g.base()); } @@ -3169,7 +3169,7 @@ namespace boost { typedef parallel::detail::remove_in_edge_predicate Pred; - assert(u.owner == g.processor()); + BOOST_ASSERT(u.owner == g.processor()); graph_detail::erase_if(get(vertex_in_edges, g.base())[u.local], Pred(g, predicate)); } @@ -3336,7 +3336,7 @@ namespace boost { (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor u, PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) { - assert(u.owner == g.processor()); + BOOST_ASSERT(u.owner == g.processor()); clear_out_edges(u.local, g.base()); } @@ -3401,7 +3401,7 @@ namespace boost { { typedef typename PBGL_DISTRIB_ADJLIST_TYPE::graph_type graph_type; typedef typename graph_type::named_graph_mixin named_graph_mixin; - assert(u.owner == g.processor()); + BOOST_ASSERT(u.owner == g.processor()); static_cast(static_cast(g)) .removing_vertex(u); g.distribution().clear(); @@ -3655,7 +3655,7 @@ namespace boost { if (owner(key) == process_id(g.process_group())) return get(p, g.base(), local(key)); else - assert(false); + BOOST_ASSERT(false); } template diff --git a/include/boost/graph/distributed/adjlist/serialization.hpp b/include/boost/graph/distributed/adjlist/serialization.hpp index d38e4d2..8c94257 100644 --- a/include/boost/graph/distributed/adjlist/serialization.hpp +++ b/include/boost/graph/distributed/adjlist/serialization.hpp @@ -9,6 +9,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +# include # include # include # include @@ -93,10 +94,10 @@ namespace detail { namespace parallel if (!filesystem::is_regular(*i)) boost::throw_exception(std::runtime_error("directory contains non-regular entries")); -#if BOOST_VERSION >= 103600 - std::string process_name = i->path().filename(); +#if BOOST_FILESYSTEM_VERSION == 3 + std::string process_name = i->path().filename().string(); #else - std::string process_name = i->leaf(); + std::string process_name = i->path().filename(); #endif for (std::string::size_type i = 0; i < process_name.size(); ++i) if (!is_digit(process_name[i])) @@ -305,7 +306,7 @@ namespace detail { namespace parallel if (is_root()) std::cout << i << " used to be " << old_ids[i] << "\n"; # endif - assert(m_id_mapping[old_ids[i]] == -1); + BOOST_ASSERT(m_id_mapping[old_ids[i]] == -1); m_id_mapping[old_ids[i]] = i; } @@ -513,7 +514,7 @@ namespace detail { namespace parallel detail::parallel::add_local_edge( local(u), local(v) , m_g.build_edge_property(property), m_g.base()); - assert(inserted.second); + BOOST_ASSERT(inserted.second); put(edge_target_processor_id, m_g.base(), inserted.first, owner(v)); edge_descriptor e(owner(u), owner(v), true, inserted.first); @@ -617,7 +618,7 @@ namespace detail { namespace parallel boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices); for (int i = 0; i < num_processes(m_pg); ++i) - assert(m_remote_vertices[i].size() == m_requested_vertices[i].size()); + BOOST_ASSERT(m_remote_vertices[i].size() == m_requested_vertices[i].size()); } template @@ -667,7 +668,7 @@ namespace detail { namespace parallel if (i == m_property_ptrs[owner(u)].end() || i->first != e.property_ptr) { - assert(false); + BOOST_ASSERT(false); } local_edge_descriptor local_edge(local(u), local(v), i->second); @@ -698,7 +699,7 @@ namespace detail { namespace parallel if (i == m_requested_vertices[owner(u)].end() || *i != local(u)) { - assert(false); + BOOST_ASSERT(false); } local_vertex_descriptor local = diff --git a/include/boost/graph/distributed/betweenness_centrality.hpp b/include/boost/graph/distributed/betweenness_centrality.hpp index 1f327da..b6ca7d0 100644 --- a/include/boost/graph/distributed/betweenness_centrality.hpp +++ b/include/boost/graph/distributed/betweenness_centrality.hpp @@ -20,6 +20,7 @@ #include #include #include +#include // For additive_reducer #include @@ -929,7 +930,7 @@ namespace boost { for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) { vertex_descriptor v = *vw; - assert(get(path_count, w) != 0); + BOOST_ASSERT(get(path_count, w) != 0); dependency_type factor = dependency_type(get(path_count, v)) / dependency_type(get(path_count, w)); diff --git a/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp b/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp index c65f80f..f079afe 100644 --- a/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp +++ b/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -220,7 +220,7 @@ boman_et_al_graph_coloring // Receive boundary colors from other processors while (optional > stp = probe(pg)) { - assert(stp->second == 17); + BOOST_ASSERT(stp->second == 17); message_type msg; receive(pg, stp->first, stp->second, msg); cache(color, msg.first, msg.second); @@ -279,7 +279,7 @@ boman_et_al_graph_coloring // Receive boundary colors from other processors while (optional > stp = probe(pg)) { - assert(stp->second == 17); + BOOST_ASSERT(stp->second == 17); message_type msg; receive(pg, stp->first, stp->second, msg); cache(color, msg.first, msg.second); @@ -298,7 +298,7 @@ boman_et_al_graph_coloring color_type num_colors = 0; BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { color_type k = get(color, v); - assert(k != no_color); + BOOST_ASSERT(k != no_color); if (k != no_color) { if (k >= (color_type)marked.size()) marked.resize(k + 1, 0); // TBD: perf? if (marked[k] != iter_num) { diff --git a/include/boost/graph/distributed/compressed_sparse_row_graph.hpp b/include/boost/graph/distributed/compressed_sparse_row_graph.hpp index 5c1d1bd..01d32cf 100644 --- a/include/boost/graph/distributed/compressed_sparse_row_graph.hpp +++ b/include/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -17,6 +17,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -366,7 +367,7 @@ class compressed_sparse_row_graph< { std::pair locator = get(vertex_global, *this, v); - assert(locator.first == process_id(m_process_group)); + BOOST_ASSERT(locator.first == process_id(m_process_group)); return base().m_vertex_properties[locator.second]; } @@ -374,19 +375,19 @@ class compressed_sparse_row_graph< { std::pair locator = get(vertex_global, *this, v); - assert(locator.first == process_id(m_process_group)); + BOOST_ASSERT(locator.first == process_id(m_process_group)); return base().m_process_group[locator.second]; } edge_bundled& operator[](edge_descriptor e) { - assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); return base().m_edge_properties[e.idx]; } const edge_bundled& operator[](edge_descriptor e) const { - assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + BOOST_ASSERT(get(vertex_owner, *this, e.src) == process_id(m_process_group)); return base().m_edge_properties[e.idx]; } diff --git a/include/boost/graph/distributed/connected_components.hpp b/include/boost/graph/distributed/connected_components.hpp index 1072b7c..fb198ab 100644 --- a/include/boost/graph/distributed/connected_components.hpp +++ b/include/boost/graph/distributed/connected_components.hpp @@ -14,6 +14,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -116,7 +117,7 @@ namespace boost { namespace graph { namespace distributed { // Receive remote roots and edges while (optional > m = probe(pg)) { - assert(m->second == root_adj_msg); + BOOST_ASSERT(m->second == root_adj_msg); std::vector adjs; receive(pg, m->first, m->second, adjs); @@ -554,12 +555,12 @@ namespace boost { namespace graph { namespace distributed { adj[*liter].begin(), adj[*liter].end() ); #ifdef PBGL_IN_PLACE_MERGE #ifdef PBGL_SORT_ASSERT - assert(__gnu_cxx::is_sorted(my_adj.begin(), - my_adj.end() - adj[*liter].size(), - std::less())); - assert(__gnu_cxx::is_sorted(my_adj.end() - adj[*liter].size(), - my_adj.end(), - std::less())); + BOOST_ASSERT(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - adj[*liter].size(), + std::less())); + BOOST_ASSERT(__gnu_cxx::is_sorted(my_adj.end() - adj[*liter].size(), + my_adj.end(), + std::less())); #endif std::inplace_merge(my_adj.begin(), my_adj.end() - adj[*liter].size(), @@ -602,12 +603,12 @@ namespace boost { namespace graph { namespace distributed { #ifdef PBGL_IN_PLACE_MERGE std::size_t num_incoming_edges = incoming_edges.size(); #ifdef PBGL_SORT_ASSERT - assert(__gnu_cxx::is_sorted(my_adj.begin(), - my_adj.end() - (num_incoming_edges-1), - std::less())); - assert(__gnu_cxx::is_sorted(my_adj.end() - (num_incoming_edges-1), - my_adj.end(), - std::less())); + BOOST_ASSERT(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - (num_incoming_edges-1), + std::less())); + BOOST_ASSERT(__gnu_cxx::is_sorted(my_adj.end() - (num_incoming_edges-1), + my_adj.end(), + std::less())); #endif std::inplace_merge(my_adj.begin(), my_adj.end() - (num_incoming_edges - 1), diff --git a/include/boost/graph/distributed/connected_components_parallel_search.hpp b/include/boost/graph/distributed/connected_components_parallel_search.hpp index 8e4d286..e8b31f8 100644 --- a/include/boost/graph/distributed/connected_components_parallel_search.hpp +++ b/include/boost/graph/distributed/connected_components_parallel_search.hpp @@ -14,6 +14,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -111,7 +112,7 @@ namespace boost { namespace graph { namespace distributed { // a mapping for that component number (which would be bad) void add(const component_value_type &a) { - assert(collisions.count(a) == 0); + BOOST_ASSERT(collisions.count(a) == 0); collisions[a] = a; } @@ -147,8 +148,8 @@ namespace boost { namespace graph { namespace distributed { // Used to resolve mapping at end of run. component_value_type update(component_value_type a) { - assert(num_unique > 0); - assert(collisions.count(a) != 0); + BOOST_ASSERT(num_unique > 0); + BOOST_ASSERT(collisions.count(a) != 0); return collisions[a]; } @@ -174,7 +175,7 @@ namespace boost { namespace graph { namespace distributed { // components in the graph. int unique(void) { - assert(num_unique > 0); + BOOST_ASSERT(num_unique > 0); return num_unique; } diff --git a/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp b/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp index 7f8d9f5..e718501 100644 --- a/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp +++ b/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp @@ -30,6 +30,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -330,7 +331,7 @@ namespace detail { crauser_et_al_shortest_paths_stats.deleted_vertices.push_back(deletions); } local_deletions = 0; - assert(deletions > 0); + BOOST_ASSERT(deletions > 0); #endif return min_distance == (std::numeric_limits::max)(); diff --git a/include/boost/graph/distributed/depth_first_search.hpp b/include/boost/graph/distributed/depth_first_search.hpp index d64f085..032902f 100644 --- a/include/boost/graph/distributed/depth_first_search.hpp +++ b/include/boost/graph/distributed/depth_first_search.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -163,7 +164,7 @@ namespace boost { break; default: - assert(false); + BOOST_ASSERT(false); } } } diff --git a/include/boost/graph/distributed/detail/mpi_process_group.ipp b/include/boost/graph/distributed/detail/mpi_process_group.ipp index ef49232..551435e 100644 --- a/include/boost/graph/distributed/detail/mpi_process_group.ipp +++ b/include/boost/graph/distributed/detail/mpi_process_group.ipp @@ -18,7 +18,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif -#include +#include #include #include #include @@ -166,7 +166,7 @@ void mpi_process_group::send_impl(int dest, int tag, const T& value, mpl::true_ /*is_mpi_datatype*/) const { - assert(tag < msg_reserved_first || tag > msg_reserved_last); + BOOST_ASSERT(tag < msg_reserved_first || tag > msg_reserved_last); impl::outgoing_messages& outgoing = impl_->outgoing[dest]; @@ -197,7 +197,7 @@ void mpi_process_group::send_impl(int dest, int tag, const T& value, mpl::false_ /*is_mpi_datatype*/) const { - assert(tag < msg_reserved_first || tag > msg_reserved_last); + BOOST_ASSERT(tag < msg_reserved_first || tag > msg_reserved_last); impl::outgoing_messages& outgoing = impl_->outgoing[dest]; @@ -246,7 +246,7 @@ typename disable_if, void>::type mpi_process_group:: array_send_impl(int dest, int tag, const T values[], std::size_t n) const { - assert(tag < msg_reserved_first || tag > msg_reserved_last); + BOOST_ASSERT(tag < msg_reserved_first || tag > msg_reserved_last); impl::outgoing_messages& outgoing = impl_->outgoing[dest]; @@ -454,7 +454,7 @@ array_receive_impl(int source, int tag, T* values, std::size_t& n) const template void mpi_process_group::trigger(int tag, const Handler& handler) { - assert(block_num); + BOOST_ASSERT(block_num); install_trigger(tag,my_block_number(),shared_ptr( new trigger_launcher(*this, tag, handler))); } @@ -462,7 +462,7 @@ void mpi_process_group::trigger(int tag, const Handler& handler) template void mpi_process_group::trigger_with_reply(int tag, const Handler& handler) { - assert(block_num); + BOOST_ASSERT(block_num); install_trigger(tag,my_block_number(),shared_ptr( new reply_trigger_launcher(*this, tag, handler))); } @@ -570,7 +570,7 @@ receive(mpi_process_group const&, int source, int tag, << " receive from source " << source << " and tag " << tag << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; #endif - assert(context == trc_out_of_band); + BOOST_ASSERT(context == trc_out_of_band); boost::parallel::detail::untracked_pair data; @@ -631,7 +631,7 @@ receive(mpi_process_group const& self, int source, int tag, if (context == trc_out_of_band) { return; } - assert (context == trc_irecv_out_of_band); + BOOST_ASSERT (context == trc_irecv_out_of_band); // force posting of new MPI_Irecv, even though buffer is already allocated boost::mpi::packed_iarchive ia(self.impl_->comm,self.impl_->buffers[tag]); @@ -656,7 +656,7 @@ prepare_receive(mpi_process_group const& self, int tag, bool force) const self.impl_->buffers[tag].resize(buffer_size); force = true; } - assert(static_cast(self.impl_->buffers[tag].size()) >= buffer_size); + BOOST_ASSERT(static_cast(self.impl_->buffers[tag].size()) >= buffer_size); //BOOST_MPL_ASSERT(mpl::not_ >); if (force) { @@ -677,7 +677,7 @@ receive(const mpi_process_group& pg, int tag, T& value) value, boost::mpi::is_mpi_datatype())) return source; } - assert (false); + BOOST_ASSERT (false); } template @@ -694,7 +694,7 @@ receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) if (result) return std::make_pair(source, n); } - assert(false); + BOOST_ASSERT(false); } template @@ -708,7 +708,7 @@ receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) values, n)) return std::make_pair(source, n); } - assert(false); + BOOST_ASSERT(false); } template @@ -724,7 +724,7 @@ receive(const mpi_process_group& pg, "Process %d failed to receive a message from process %d with tag %d in block %d.\n", process_id(pg), source, tag, pg.my_block_number()); - assert(false); + BOOST_ASSERT(false); exit(1); } } @@ -745,7 +745,7 @@ receive(const mpi_process_group& pg, int source, int tag, T values[], "Process %d failed to receive a message from process %d with tag %d in block %d.\n", process_id(pg), source, tag, pg.my_block_number()); - assert(false); + BOOST_ASSERT(false); exit(1); } } @@ -837,7 +837,7 @@ all_gather(const mpi_process_group& pg, InputIterator first, int result = MPI_Allgather(&size, 1, MPI_INT, &sizes[0], 1, MPI_INT, communicator(pg)); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); // Adjust sizes based on the number of bytes std::transform(sizes.begin(), sizes.end(), sizes.begin(), @@ -860,7 +860,7 @@ all_gather(const mpi_process_group& pg, InputIterator first, &out[0], &sizes[0], &displacements[0], MPI_BYTE, communicator(pg)); } - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); } template @@ -878,25 +878,25 @@ process_subgroup(const mpi_process_group& pg, MPI_Group current_group; int result = MPI_Comm_group(communicator(pg), ¤t_group); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); MPI_Group new_group; result = MPI_Group_incl(current_group, ranks.size(), &ranks[0], &new_group); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); MPI_Comm new_comm; result = MPI_Comm_create(communicator(pg), new_group, &new_comm); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); result = MPI_Group_free(&new_group); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); result = MPI_Group_free(¤t_group); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); if (new_comm != MPI_COMM_NULL) { mpi_process_group result_pg(boost::mpi::communicator(new_comm,boost::mpi::comm_attach)); result = MPI_Comm_free(&new_comm); - assert(result == 0); + BOOST_ASSERT(result == 0); return result_pg; } else { return mpi_process_group(mpi_process_group::create_empty()); diff --git a/include/boost/graph/distributed/detail/remote_update_set.hpp b/include/boost/graph/distributed/detail/remote_update_set.hpp index 08f4316..ef0e977 100644 --- a/include/boost/graph/distributed/detail/remote_update_set.hpp +++ b/include/boost/graph/distributed/detail/remote_update_set.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -110,7 +110,7 @@ private: case msg_updates: { updates_size_type num_updates = update_sizes[source]; - assert(num_updates); + BOOST_ASSERT(num_updates); // Receive the actual updates std::vector updates(num_updates); @@ -207,7 +207,7 @@ private: void operator()(process_id_type source, int tag) { // Receive the # of updates - assert(tag == msg_update); + BOOST_ASSERT(tag == msg_update); update_pair_type update; receive(self->process_group, source, tag, update); diff --git a/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp b/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp index a516daf..8a2098f 100644 --- a/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp +++ b/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp @@ -22,6 +22,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -284,7 +285,7 @@ template 0); + BOOST_ASSERT(deletions > 0); #endif return min_distance == (std::numeric_limits::max)(); diff --git a/include/boost/graph/distributed/hohberg_biconnected_components.hpp b/include/boost/graph/distributed/hohberg_biconnected_components.hpp index 249e8b0..1cce5c8 100644 --- a/include/boost/graph/distributed/hohberg_biconnected_components.hpp +++ b/include/boost/graph/distributed/hohberg_biconnected_components.hpp @@ -39,7 +39,7 @@ #include #include #include // for std::pair -#include +#include #include // for std::find, std::mismatch #include #include @@ -136,9 +136,9 @@ namespace hohberg_detail { template T branch_point(const std::vector& p1, const std::vector& p2) { - assert(!p1.empty()); - assert(!p2.empty()); - assert(p1.front() == p2.front()); + BOOST_ASSERT(!p1.empty()); + BOOST_ASSERT(!p2.empty()); + BOOST_ASSERT(p1.front() == p2.front()); typedef typename std::vector::const_iterator iterator; @@ -385,7 +385,7 @@ class hohberg_vertex_processor template void serialize(Archiver&, const unsigned int /*version*/) { - assert(false); + BOOST_ASSERT(false); } }; @@ -523,7 +523,7 @@ hohberg_vertex_processor::operator()(Edge e, path_t& path, default: // std::cerr << "Phase is " << int(phase) << "\n"; - assert(false); + BOOST_ASSERT(false); } } @@ -579,7 +579,7 @@ hohberg_vertex_processor::operator()(Edge e, Vertex gamma, break; default: - assert(false); + BOOST_ASSERT(false); } } @@ -596,7 +596,7 @@ hohberg_vertex_processor::operator()(Edge e, edges_size_type name, << name << "), phase = " << (int)phase << std::endl; #endif - assert(phase == 4); + BOOST_ASSERT(phase == 4); typename property_map::const_type owner = get(vertex_owner, g); @@ -684,7 +684,7 @@ start_naming_phase(Vertex alpha, const Graph& g, edges_size_type offset) { using namespace hohberg_detail; - assert(phase == 4); + BOOST_ASSERT(phase == 4); typename property_map::const_type owner = get(vertex_owner, g); @@ -870,7 +870,7 @@ hohberg_vertex_processor::get_edge_index(Edge e, const Graph& g) if (source(e, g) == target(oe, g)) return result; ++result; } - assert(false); + BOOST_ASSERT(false); } template @@ -883,7 +883,7 @@ hohberg_vertex_processor::get_incident_edge_index(Vertex u, Vertex v, if (target(e, g) == v) return result; ++result; } - assert(false); + BOOST_ASSERT(false); } template header; receive(pg, msg->first, msg->second, header); - assert(path_length == header.path_length); + BOOST_ASSERT(path_length == header.path_length); // Receive the path itself path_t path(path_length); @@ -966,7 +966,7 @@ hohberg_biconnected_components case msg_path_vertices: // Should be handled in msg_path_header case, unless we're going // stateless. - assert(false); + BOOST_ASSERT(false); break; case msg_tree_header: @@ -989,7 +989,7 @@ hohberg_biconnected_components case msg_tree_vertices: // Should be handled in msg_tree_header case, unless we're // going stateless. - assert(false); + BOOST_ASSERT(false); break; case msg_name: @@ -1002,7 +1002,7 @@ hohberg_biconnected_components break; default: - assert(false); + BOOST_ASSERT(false); } } ++path_length; diff --git a/include/boost/graph/distributed/named_graph.hpp b/include/boost/graph/distributed/named_graph.hpp index 83b0061..6984c02 100644 --- a/include/boost/graph/distributed/named_graph.hpp +++ b/include/boost/graph/distributed/named_graph.hpp @@ -14,6 +14,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -393,7 +394,7 @@ typename BGL_NAMED_GRAPH::vertex_descriptor BGL_NAMED_GRAPH::lazy_add_vertex::commit() const { typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; - assert (!committed); + BOOST_ASSERT (!committed); committed = true; process_id_type owner = self.named_distribution()(name); @@ -530,7 +531,7 @@ BGL_NAMED_GRAPH::lazy_add_edge::commit() const typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; using boost::parallel::detail::make_untracked_pair; - assert(!committed); + BOOST_ASSERT(!committed); committed = true; /// The result we will return, if we are sending a message to @@ -729,7 +730,7 @@ BGL_NAMED_GRAPH::lazy_add_edge_with_property::commit() const { using boost::detail::parallel::make_pair_with_property; typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; - assert(!committed); + BOOST_ASSERT(!committed); committed = true; /// The result we will return, if we are sending a message to diff --git a/include/boost/graph/distributed/page_rank.hpp b/include/boost/graph/distributed/page_rank.hpp index aae418f..c2c230d 100644 --- a/include/boost/graph/distributed/page_rank.hpp +++ b/include/boost/graph/distributed/page_rank.hpp @@ -15,6 +15,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -53,7 +54,7 @@ namespace detail { 1, MPI_DOUBLE, get(owner, v), local(v), 1, MPI_DOUBLE, MPI_SUM, to_win); - assert(MPI_SUCCESS == ret); + BOOST_ASSERT(MPI_SUCCESS == ret); } } MPI_Win_fence(0, to_win); @@ -100,14 +101,14 @@ page_rank_impl(const Graph& g, RankMap rank_map, Done done, process_group_type pg = process_group(g); process_id_type id = process_id(pg); - assert(me == id); + BOOST_ASSERT(me == id); rank_type initial_rank = rank_type(rank_type(1) / n); BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, initial_rank); #ifdef WANT_MPI_ONESIDED - assert(sizeof(rank_type) == sizeof(double)); + BOOST_ASSERT(sizeof(rank_type) == sizeof(double)); bool to_map_2 = true; MPI_Win win, win2; diff --git a/include/boost/graph/distributed/rmat_graph_generator.hpp b/include/boost/graph/distributed/rmat_graph_generator.hpp index 8b60043..dec8250 100644 --- a/include/boost/graph/distributed/rmat_graph_generator.hpp +++ b/include/boost/graph/distributed/rmat_graph_generator.hpp @@ -13,6 +13,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +#include #include #include #include @@ -51,7 +52,7 @@ namespace boost { double d, bool permute_vertices = true) : gen(), done(false) { - assert(a + b + c + d == 1); + BOOST_ASSERT(a + b + c + d == 1); int id = process_id(pg); this->gen.reset(new uniform_01(gen)); diff --git a/include/boost/graph/distributed/shuffled_distribution.hpp b/include/boost/graph/distributed/shuffled_distribution.hpp index 92bc039..6d39fb6 100644 --- a/include/boost/graph/distributed/shuffled_distribution.hpp +++ b/include/boost/graph/distributed/shuffled_distribution.hpp @@ -9,6 +9,7 @@ #error "Parallel BGL files should not be included unless has been included" #endif +# include # include # include @@ -36,7 +37,7 @@ struct shuffled_distribution : BaseDistribution void assign_mapping(InputIterator first, InputIterator last) { mapping_.assign(first, last); - assert(mapping_.size() == n); + BOOST_ASSERT(mapping_.size() == n); reverse_mapping.resize(mapping_.size()); for (std::vector::iterator i(mapping_.begin()); diff --git a/include/boost/graph/distributed/strong_components.hpp b/include/boost/graph/distributed/strong_components.hpp index d7de8b4..f2c021f 100644 --- a/include/boost/graph/distributed/strong_components.hpp +++ b/include/boost/graph/distributed/strong_components.hpp @@ -16,6 +16,7 @@ // #define PBGL_SCC_DEBUG +#include #include #include #include @@ -511,7 +512,7 @@ namespace boost { namespace graph { namespace distributed { // Receive predecessor and successor messages and handle them while (optional > m = probe(pg)) { - assert(m->second == fhp_succ_size_msg || m->second == fhp_pred_size_msg); + BOOST_ASSERT(m->second == fhp_succ_size_msg || m->second == fhp_pred_size_msg); std::size_t num_requests; receive(pg, m->first, m->second, num_requests); VertexPairVec requests(num_requests); @@ -791,7 +792,7 @@ namespace boost { namespace graph { namespace distributed { // Receive edge addition requests and handle them while (optional > m = probe(pg)) { - assert(m->second == fhp_edges_size_msg); + BOOST_ASSERT(m->second == fhp_edges_size_msg); std::size_t num_requests; receive(pg, m->first, m->second, num_requests); VertexPairVec requests(num_requests); diff --git a/include/boost/graph/parallel/distribution.hpp b/include/boost/graph/parallel/distribution.hpp index d717a1f..8256b19 100644 --- a/include/boost/graph/parallel/distribution.hpp +++ b/include/boost/graph/parallel/distribution.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -194,7 +195,7 @@ struct uneven_block explicit uneven_block(const LinearProcessGroup& pg, const std::vector& local_sizes) : id(process_id(pg)), p(num_processes(pg)), local_sizes(local_sizes) { - assert(local_sizes.size() == p); + BOOST_ASSERT(local_sizes.size() == p); local_starts.resize(p + 1); local_starts[0] = 0; std::partial_sum(local_sizes.begin(), local_sizes.end(), &local_starts[1]); @@ -219,7 +220,7 @@ struct uneven_block template SizeType operator()(SizeType i) const { - assert (i >= (SizeType) 0 && i < (SizeType) n); // check for valid range + BOOST_ASSERT (i >= (SizeType) 0 && i < (SizeType) n); // check for valid range size_vector::const_iterator lb = std::lower_bound(local_starts.begin(), local_starts.end(), (std::size_t) i); return ((SizeType)(*lb) == i ? lb : --lb) - local_starts.begin(); } @@ -402,7 +403,7 @@ struct twod_block_cyclic std::cerr << "global(" << i << "@" << id << ") = " << result << " =? " << local(result) << std::endl; - assert(i == local(result)); + BOOST_ASSERT(i == local(result)); return result; } diff --git a/src/mpi_process_group.cpp b/src/mpi_process_group.cpp index 4bb9a37..546c907 100644 --- a/src/mpi_process_group.cpp +++ b/src/mpi_process_group.cpp @@ -9,6 +9,7 @@ // Authors: Douglas Gregor // Andrew Lumsdaine // Matthias Troyer +#include #include #include #include @@ -172,7 +173,7 @@ void handle_sync (mpi_process_group const& self, int source, int tag, int val, std::size_t stage = static_cast( ++self.impl_->synchronizing_stage[source]); - assert(source != process_id(self)); + BOOST_ASSERT(source != process_id(self)); #ifdef DEBUG std::ostringstream out; @@ -183,7 +184,7 @@ void handle_sync (mpi_process_group const& self, int source, int tag, int val, // record how many still have messages to be sent if (self.impl_->synchronizing_unfinished.size()<=stage) { - assert(self.impl_->synchronizing_unfinished.size() == stage); + BOOST_ASSERT(self.impl_->synchronizing_unfinished.size() == stage); self.impl_->synchronizing_unfinished.push_back(val >= 0 ? 1 : 0); } else @@ -191,7 +192,7 @@ void handle_sync (mpi_process_group const& self, int source, int tag, int val, // record how many are in that stage if (self.impl_->processors_synchronizing_stage.size()<=stage) { - assert(self.impl_->processors_synchronizing_stage.size() == stage); + BOOST_ASSERT(self.impl_->processors_synchronizing_stage.size() == stage); self.impl_->processors_synchronizing_stage.push_back(1); } else @@ -346,7 +347,7 @@ replace_on_synchronize_handler(const on_synchronize_event_type& handler) int mpi_process_group::allocate_block(bool out_of_band_receive) { - assert(!block_num); + BOOST_ASSERT(!block_num); block_iterator i = impl_->blocks.begin(); while (i != impl_->blocks.end() && *i) ++i; @@ -372,7 +373,7 @@ bool mpi_process_group::maybe_emit_receive(int process, int encoded_tag) const { std::pair decoded = decode_tag(encoded_tag); - assert (decoded.first < static_cast(impl_->blocks.size())); + BOOST_ASSERT (decoded.first < static_cast(impl_->blocks.size())); block_type* block = impl_->blocks[decoded.first]; if (!block) { @@ -384,7 +385,7 @@ bool mpi_process_group::maybe_emit_receive(int process, int encoded_tag) const if (impl_->blocks[i]) std::cerr << i << ' '; std::cerr << std::endl; - assert(block); + BOOST_ASSERT(block); } if (decoded.second < static_cast(block->triggers.size()) @@ -414,7 +415,7 @@ bool mpi_process_group::emit_receive(int process, int encoded_tag) const // Find the block that will receive this message block_type* block = impl_->blocks[decoded.first]; - assert(block); + BOOST_ASSERT(block); if (decoded.second < static_cast(block->triggers.size()) && block->triggers[decoded.second]) // We have a trigger for this message; use it @@ -526,7 +527,7 @@ mpi_process_group::send_batch(process_id_type dest, // we increment the number of batches sent ++impl_->number_sent_batches[dest]; // and send the batch - assert(outgoing.headers.size() <= impl_->batch_header_number); + BOOST_ASSERT(outgoing.headers.size() <= impl_->batch_header_number); if (id != dest) { #ifdef NO_ISEND_BATCHES impl::batch_request req; @@ -559,7 +560,7 @@ mpi_process_group::send_batch(process_id_type dest, MPI_Isend(const_cast(oa.address()), oa.size(), MPI_PACKED, dest, tag, impl_->comm, &req.request); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); impl_->max_sent = (std::max)(impl_->max_sent,impl_->sent_batches.size()); #ifdef NO_ISEND_BATCHES int done=0; @@ -794,10 +795,10 @@ void mpi_process_group::synchronize() const ++impl_->synchronizing_stage[id]; if (impl_->synchronizing_stage[id] != stage) std::cerr << "Expected stage " << stage << ", got " << impl_->synchronizing_stage[id] << std::endl; - assert(impl_->synchronizing_stage[id]==stage); + BOOST_ASSERT(impl_->synchronizing_stage[id]==stage); // record how many still have messages to be sent if (static_cast(impl_->synchronizing_unfinished.size())<=stage) { - assert(static_cast(impl_->synchronizing_unfinished.size()) == stage); + BOOST_ASSERT(static_cast(impl_->synchronizing_unfinished.size()) == stage); impl_->synchronizing_unfinished.push_back(no_new_messages ? 0 : 1); } else @@ -805,7 +806,7 @@ void mpi_process_group::synchronize() const // record how many are in that stage if (static_cast(impl_->processors_synchronizing_stage.size())<=stage) { - assert(static_cast(impl_->processors_synchronizing_stage.size()) == stage); + BOOST_ASSERT(static_cast(impl_->processors_synchronizing_stage.size()) == stage); impl_->processors_synchronizing_stage.push_back(1); } else @@ -841,7 +842,7 @@ void mpi_process_group::synchronize() const // check that everyone is at least here for (int source=0; source

synchronizing_stage[source] >= stage); + BOOST_ASSERT(impl_->synchronizing_stage[source] >= stage); // receive any batches sent in the meantime // all have to be available already @@ -857,7 +858,7 @@ void mpi_process_group::synchronize() const #ifndef NO_IMMEDIATE_PROCESSING for (int source=0; source

number_received_batches[source] >= 0); + BOOST_ASSERT(impl_->number_received_batches[source] >= 0); #endif impl_->synchronizing = false; @@ -888,7 +889,7 @@ void mpi_process_group::synchronize() const << source << ", got " << impl_->synchronizing_stage[source] << std::endl; } - assert(impl_->synchronizing_stage[source]==stage); + BOOST_ASSERT(impl_->synchronizing_stage[source]==stage); } #endif std::fill(impl_->synchronizing_stage.begin(), @@ -900,10 +901,10 @@ void mpi_process_group::synchronize() const impl_->synchronizing_unfinished.clear(); for (process_id_type dest = 0; dest < p; ++dest) - assert (impl_->outgoing[dest].headers.empty()); + BOOST_ASSERT (impl_->outgoing[dest].headers.empty()); #ifndef NO_IMMEDIATE_PROCESSING for (int source=0; source

number_received_batches[source] == 0); + BOOST_ASSERT (impl_->number_received_batches[source] == 0); #endif impl_->free_sent_batches(); @@ -952,7 +953,7 @@ void mpi_process_group::poll_requests(int block) const std::pair decoded = decode_tag(statuses[i].MPI_TAG); block_type* block = impl_->blocks[decoded.first]; - assert (decoded.second < static_cast(block->triggers.size()) && block->triggers[decoded.second]); + BOOST_ASSERT (decoded.second < static_cast(block->triggers.size()) && block->triggers[decoded.second]); // We have a trigger for this message; use it trigger_receive_context old_context = impl_->trigger_context; impl_->trigger_context = trc_irecv_out_of_band; @@ -1033,7 +1034,7 @@ void mpi_process_group::impl::free_sent_batches() int result; while(it != sent_batches.end()) { result = MPI_Test(&it->request,&flag,MPI_STATUS_IGNORE); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); iterator next=it; ++next; if (flag) @@ -1044,7 +1045,7 @@ void mpi_process_group::impl::free_sent_batches() for (std::size_t i=0; i< batch_pool.size();++i) { if(batch_pool[i].request != MPI_REQUEST_NULL) { result = MPI_Test(&batch_pool[i].request,&flag,MPI_STATUS_IGNORE); - assert(result == MPI_SUCCESS); + BOOST_ASSERT(result == MPI_SUCCESS); if (flag) { free_batches.push(i); batch_pool[i].request = MPI_REQUEST_NULL; @@ -1060,7 +1061,7 @@ mpi_process_group::install_trigger(int tag, int block, shared_ptr const& launcher) { block_type* my_block = impl_->blocks[block]; - assert(my_block); + BOOST_ASSERT(my_block); // Make sure we have enough space in the structure for this trigger. if (launcher->tag() >= static_cast(my_block->triggers.size())) @@ -1073,7 +1074,7 @@ mpi_process_group::install_trigger(int tag, int block, << " already has a trigger for tag " << launcher->tag() << std::endl; } - assert(!my_block->triggers[launcher->tag()]); + BOOST_ASSERT(!my_block->triggers[launcher->tag()]); // Attach a new trigger launcher my_block->triggers[launcher->tag()] = launcher; @@ -1091,8 +1092,8 @@ void mpi_process_group::set_message_buffer_size(std::size_t s) void* ptr; if (!message_buffer.empty()) { MPI_Buffer_detach(&ptr,&sz); - assert(ptr == &message_buffer.front()); - assert(static_cast(sz) == message_buffer.size()); + BOOST_ASSERT(ptr == &message_buffer.front()); + BOOST_ASSERT(static_cast(sz) == message_buffer.size()); } else if (old_buffer != 0) MPI_Buffer_detach(&old_buffer,&old_buffer_size);