Chris@102: // Copyright 2004 The Trustees of Indiana University. Chris@102: Chris@102: // Use, modification and distribution is subject to the Boost Software Chris@102: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@102: // http://www.boost.org/LICENSE_1_0.txt) Chris@102: Chris@102: // Authors: Douglas Gregor Chris@102: // Andrew Lumsdaine Chris@102: #ifndef BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP Chris@102: #define BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: namespace boost { namespace parallel { Chris@102: Chris@102: /** Chris@102: * A special type used as a flag to a process group constructor that Chris@102: * indicates that the copy of a process group will represent a new Chris@102: * distributed data structure. Chris@102: */ Chris@102: struct attach_distributed_object { }; Chris@102: Chris@102: /** Chris@102: * Describes the context in which a trigger is being invoked to Chris@102: * receive a message. Chris@102: */ Chris@102: enum trigger_receive_context { Chris@102: /// No trigger is active at this time. Chris@102: trc_none, Chris@102: /// The trigger is being invoked during synchronization, at the end Chris@102: /// of a superstep. Chris@102: trc_in_synchronization, Chris@102: /// The trigger is being invoked as an "early" receive of a message Chris@102: /// that was sent through the normal "send" operations to be Chris@102: /// received by the end of the superstep, but the process group sent Chris@102: /// the message earlier to clear its buffers. Chris@102: trc_early_receive, Chris@102: /// The trigger is being invoked for an out-of-band message, which Chris@102: /// must be handled immediately. Chris@102: trc_out_of_band, Chris@102: /// The trigger is being invoked for an out-of-band message, which Chris@102: /// must be handled immediately and has alredy been received by Chris@102: /// an MPI_IRecv call. Chris@102: trc_irecv_out_of_band Chris@102: }; Chris@102: Chris@102: // Process group tags Chris@102: struct process_group_tag {}; Chris@102: struct linear_process_group_tag : virtual process_group_tag {}; Chris@102: struct messaging_process_group_tag : virtual process_group_tag {}; Chris@102: struct immediate_process_group_tag : virtual messaging_process_group_tag {}; Chris@102: struct bsp_process_group_tag : virtual messaging_process_group_tag {}; Chris@102: struct batch_process_group_tag : virtual messaging_process_group_tag {}; Chris@102: struct locking_process_group_tag : virtual process_group_tag {}; Chris@102: struct spawning_process_group_tag : virtual process_group_tag {}; Chris@102: Chris@102: struct process_group_archetype Chris@102: { Chris@102: typedef int process_id_type; Chris@102: }; Chris@102: Chris@102: void wait(process_group_archetype&); Chris@102: void synchronize(process_group_archetype&); Chris@102: int process_id(const process_group_archetype&); Chris@102: int num_processes(const process_group_archetype&); Chris@102: Chris@102: template void send(process_group_archetype&, int, int, const T&); Chris@102: Chris@102: template Chris@102: process_group_archetype::process_id_type Chris@102: receive(const process_group_archetype& pg, Chris@102: process_group_archetype::process_id_type source, int tag, T& value); Chris@102: Chris@102: template Chris@102: std::pair Chris@102: receive(const process_group_archetype& pg, int tag, T values[], std::size_t n); Chris@102: Chris@102: template Chris@102: std::pair Chris@102: receive(const process_group_archetype& pg, Chris@102: process_group_archetype::process_id_type source, int tag, T values[], Chris@102: std::size_t n); Chris@102: Chris@102: } } // end namespace boost::parallel Chris@102: Chris@102: namespace boost { namespace graph { namespace distributed { Chris@102: using boost::parallel::trigger_receive_context; Chris@102: using boost::parallel::trc_early_receive; Chris@102: using boost::parallel::trc_out_of_band; Chris@102: using boost::parallel::trc_irecv_out_of_band; Chris@102: using boost::parallel::trc_in_synchronization; Chris@102: using boost::parallel::trc_none; Chris@102: using boost::parallel::attach_distributed_object; Chris@102: } } } // end namespace boost::graph::distributed Chris@102: Chris@102: #endif // BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP