1 // Copyright 2004 The Trustees of Indiana University.
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // Authors: Douglas Gregor
9 #ifndef BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP
10 #define BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP
15 namespace boost { namespace parallel {
18 * A special type used as a flag to a process group constructor that
19 * indicates that the copy of a process group will represent a new
20 * distributed data structure.
22 struct attach_distributed_object { };
25 * Describes the context in which a trigger is being invoked to
28 enum trigger_receive_context {
29 /// No trigger is active at this time.
31 /// The trigger is being invoked during synchronization, at the end
33 trc_in_synchronization,
34 /// The trigger is being invoked as an "early" receive of a message
35 /// that was sent through the normal "send" operations to be
36 /// received by the end of the superstep, but the process group sent
37 /// the message earlier to clear its buffers.
39 /// The trigger is being invoked for an out-of-band message, which
40 /// must be handled immediately.
42 /// The trigger is being invoked for an out-of-band message, which
43 /// must be handled immediately and has alredy been received by
44 /// an MPI_IRecv call.
49 struct process_group_tag {};
50 struct linear_process_group_tag : virtual process_group_tag {};
51 struct messaging_process_group_tag : virtual process_group_tag {};
52 struct immediate_process_group_tag : virtual messaging_process_group_tag {};
53 struct bsp_process_group_tag : virtual messaging_process_group_tag {};
54 struct batch_process_group_tag : virtual messaging_process_group_tag {};
55 struct locking_process_group_tag : virtual process_group_tag {};
56 struct spawning_process_group_tag : virtual process_group_tag {};
58 struct process_group_archetype
60 typedef int process_id_type;
63 void wait(process_group_archetype&);
64 void synchronize(process_group_archetype&);
65 int process_id(const process_group_archetype&);
66 int num_processes(const process_group_archetype&);
68 template<typename T> void send(process_group_archetype&, int, int, const T&);
71 process_group_archetype::process_id_type
72 receive(const process_group_archetype& pg,
73 process_group_archetype::process_id_type source, int tag, T& value);
76 std::pair<process_group_archetype::process_id_type, std::size_t>
77 receive(const process_group_archetype& pg, int tag, T values[], std::size_t n);
80 std::pair<process_group_archetype::process_id_type, std::size_t>
81 receive(const process_group_archetype& pg,
82 process_group_archetype::process_id_type source, int tag, T values[],
85 } } // end namespace boost::parallel
87 namespace boost { namespace graph { namespace distributed {
88 using boost::parallel::trigger_receive_context;
89 using boost::parallel::trc_early_receive;
90 using boost::parallel::trc_out_of_band;
91 using boost::parallel::trc_irecv_out_of_band;
92 using boost::parallel::trc_in_synchronization;
93 using boost::parallel::trc_none;
94 using boost::parallel::attach_distributed_object;
95 } } } // end namespace boost::graph::distributed
97 #endif // BOOST_PROPERTY_MAP_PARALLEL_PROCESS_GROUP_HPP