x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
all_gather.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\mpi\collectives\all_gather.hpp
旋转
特效
属性
历史版本
// Copyright (C) 2005-2006 Douglas Gregor
. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Message Passing Interface 1.1 -- Section 4.7. Gather-to-all #ifndef BOOST_MPI_ALL_GATHER_HPP #define BOOST_MPI_ALL_GATHER_HPP #include
#include
#include
#include
// all_gather falls back to gather+broadcast in some cases #include
#include
namespace boost { namespace mpi { namespace detail { // We're all-gathering for a type that has an associated MPI // datatype, so we'll use MPI_Gather to do all of the work. template
void all_gather_impl(const communicator& comm, const T* in_values, int n, T* out_values, mpl::true_) { MPI_Datatype type = boost::mpi::get_mpi_datatype
(*in_values); BOOST_MPI_CHECK_RESULT(MPI_Allgather, (const_cast
(in_values), n, type, out_values, n, type, comm)); } // We're all-gathering for a type that has no associated MPI // type. So, we'll do a manual gather followed by a broadcast. template
void all_gather_impl(const communicator& comm, const T* in_values, int n, T* out_values, mpl::false_) { std::cerr << comm.rank() << ": gathering " << n << " values to root 0..." << std::endl; std::cerr << in_values << ", " << out_values << std::endl; gather(comm, in_values, n, out_values, 0); std::cerr << comm.rank() << ": broadcasting from root 0..." << std::endl; broadcast(comm, out_values, comm.size() * n, 0); } } // end namespace detail template
inline void all_gather(const communicator& comm, const T& in_value, T* out_values) { detail::all_gather_impl(comm, &in_value, 1, out_values, is_mpi_datatype
()); } template
void all_gather(const communicator& comm, const T& in_value, std::vector
& out_values) { out_values.resize(comm.size()); ::boost::mpi::all_gather(comm, &in_value, 1, &out_values[0]); } template
inline void all_gather(const communicator& comm, const T* in_values, int n, T* out_values) { detail::all_gather_impl(comm, in_values, n, out_values, is_mpi_datatype
()); } template
void all_gather(const communicator& comm, const T* in_values, int n, std::vector
& out_values) { out_values.resize(comm.size() * n); ::boost::mpi::all_gather(comm, in_values, n, &out_values[0]); } } } // end namespace boost::mpi #endif // BOOST_MPI_ALL_GATHER_HPP
all_gather.hpp
网页地址
文件地址
上一页 1/8
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.