Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/mpi/detail/broadcast_sc.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
rev | line source |
---|---|
Chris@16 | 1 // Copyright (C) 2005, 2006 Douglas Gregor <doug.gregor -at- gmail.com>. |
Chris@16 | 2 |
Chris@16 | 3 // Use, modification and distribution is subject to the Boost Software |
Chris@16 | 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
Chris@16 | 5 // http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 6 |
Chris@16 | 7 // Allows broadcast of skeletons via proxy. |
Chris@16 | 8 |
Chris@16 | 9 // This header may only be included after both the broadcast.hpp and |
Chris@16 | 10 // and skeleton_and_content.hpp headers have been included. |
Chris@16 | 11 #ifndef BOOST_MPI_BROADCAST_SC_HPP |
Chris@16 | 12 #define BOOST_MPI_BROADCAST_SC_HPP |
Chris@16 | 13 |
Chris@16 | 14 namespace boost { namespace mpi { |
Chris@16 | 15 |
Chris@16 | 16 template<typename T> |
Chris@16 | 17 inline void |
Chris@16 | 18 broadcast(const communicator& comm, skeleton_proxy<T>& proxy, int root) |
Chris@16 | 19 { |
Chris@16 | 20 const skeleton_proxy<T>& const_proxy(proxy); |
Chris@16 | 21 broadcast(comm, const_proxy, root); |
Chris@16 | 22 } |
Chris@16 | 23 |
Chris@16 | 24 template<typename T> |
Chris@16 | 25 void |
Chris@16 | 26 broadcast(const communicator& comm, const skeleton_proxy<T>& proxy, int root) |
Chris@16 | 27 { |
Chris@16 | 28 if (comm.rank() == root) { |
Chris@16 | 29 packed_skeleton_oarchive oa(comm); |
Chris@16 | 30 oa << proxy.object; |
Chris@16 | 31 broadcast(comm, oa, root); |
Chris@16 | 32 } else { |
Chris@16 | 33 packed_skeleton_iarchive ia(comm); |
Chris@16 | 34 broadcast(comm, ia, root); |
Chris@16 | 35 ia >> proxy.object; |
Chris@16 | 36 } |
Chris@16 | 37 } |
Chris@16 | 38 |
Chris@16 | 39 } } // end namespace boost::mpi |
Chris@16 | 40 |
Chris@16 | 41 #endif // BOOST_MPI_BROADCAST_SC_HPP |