]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph_parallel/test/process_group_serialization.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / graph_parallel / test / process_group_serialization.cpp
1 // Copyright (C) 2006 The Trustees of Indiana University.
2
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)
6
7 // Authors: Douglas Gregor
8 // Andrew Lumsdaine
9
10 // FIXME: Including because of a missing header in the serialization library.
11 // Patch sent to list...
12 #include <cassert>
13
14 #include <boost/graph/use_mpi.hpp>
15 #include <boost/config.hpp>
16 #include <boost/throw_exception.hpp>
17 #include <boost/serialization/list.hpp>
18 #include <boost/graph/distributed/mpi_process_group.hpp>
19 #include <boost/test/minimal.hpp>
20
21 #ifdef BOOST_NO_EXCEPTIONS
22 void
23 boost::throw_exception(std::exception const& ex)
24 {
25 std::cout << ex.what() << std::endl;
26 abort();
27 }
28 #endif
29
30 using boost::graph::distributed::mpi_process_group;
31
32 int test_main(int argc, char** argv)
33 {
34 boost::mpi::environment env(argc, argv);
35
36 mpi_process_group pg;
37
38 int seventeen = 17;
39 std::list<int> seventeens(17, 17);
40
41 if (process_id(pg) == 0) {
42 send(pg, 1, 0, seventeen);
43 send(pg, 1, 1, seventeens);
44 }
45 synchronize(pg);
46
47 if (process_id(pg) == 1) {
48 int value;
49 receive(pg, 0, 0, value);
50 BOOST_CHECK(seventeen == value);
51
52 std::list<int> values;
53 receive(pg, 0, 1, values);
54 BOOST_CHECK(seventeens == values);
55 }
56
57 return 0;
58 }