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