x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
all_reduce.hpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\mpi\collectives\all_reduce.hpp
Girar
Efecto
Propiedad
Historial
// Copyright (C) 2005-2006 Douglas Gregor
// Copyright (C) 2004 The Trustees of Indiana University // 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) // Authors: Douglas Gregor // Andrew Lumsdaine // Message Passing Interface 1.1 -- Section 4.9.1. Reduce #ifndef BOOST_MPI_ALL_REDUCE_HPP #define BOOST_MPI_ALL_REDUCE_HPP // All-reduce falls back to reduce() + broadcast() in some cases. #include
#include
namespace boost { namespace mpi { namespace detail { /********************************************************************** * Simple reduction with MPI_Allreduce * **********************************************************************/ // We are reducing for a type that has an associated MPI // datatype and operation, so we'll use MPI_Allreduce directly. template
void all_reduce_impl(const communicator& comm, const T* in_values, int n, T* out_values, Op op, mpl::true_ /*is_mpi_op*/, mpl::true_ /*is_mpi_datatype*/) { BOOST_MPI_CHECK_RESULT(MPI_Allreduce, (const_cast
(in_values), out_values, n, boost::mpi::get_mpi_datatype
(*in_values), is_mpi_op
::op(), comm)); } /********************************************************************** * User-defined reduction with MPI_Allreduce * **********************************************************************/ // We are reducing at the root for a type that has an associated MPI // datatype but with a custom operation. We'll use MPI_Reduce // directly, but we'll need to create an MPI_Op manually. template
void all_reduce_impl(const communicator& comm, const T* in_values, int n, T* out_values, Op op, mpl::false_ /*is_mpi_op*/, mpl::true_ /*is_mpi_datatype*/) { user_op
mpi_op(op); BOOST_MPI_CHECK_RESULT(MPI_Allreduce, (const_cast
(in_values), out_values, n, boost::mpi::get_mpi_datatype
(*in_values), mpi_op.get_mpi_op(), comm)); } /********************************************************************** * User-defined, tree-based reduction for non-MPI data types * **********************************************************************/ // We are reducing at the root for a type that has no associated MPI // datatype and operation, so we'll use a simple tree-based // algorithm. template
void all_reduce_impl(const communicator& comm, const T* in_values, int n, T* out_values, Op op, mpl::false_ /*is_mpi_op*/, mpl::false_ /*is_mpi_datatype*/) { reduce(comm, in_values, n, out_values, op, 0); broadcast(comm, out_values, n, 0); } } // end namespace detail template
inline void all_reduce(const communicator& comm, const T* in_values, int n, T* out_values, Op op) { detail::all_reduce_impl(comm, in_values, n, out_values, op, is_mpi_op
(), is_mpi_datatype
()); } template
inline void all_reduce(const communicator& comm, const T& in_value, T& out_value, Op op) { detail::all_reduce_impl(comm, &in_value, 1, &out_value, op, is_mpi_op
(), is_mpi_datatype
()); } template
T all_reduce(const communicator& comm, const T& in_value, Op op) { T result; ::boost::mpi::all_reduce(comm, in_value, result, op); return result; } } } // end namespace boost::mpi #endif // BOOST_MPI_ALL_REDUCE_HPP
all_reduce.hpp
Dirección de la página
Dirección del archivo
Anterior
2/8
Siguiente
Descargar
( 4 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.