From 2705353f1d5520a7c3a02272b5f93cfcaab189e1 Mon Sep 17 00:00:00 2001 From: Hartmut Hafermann Date: Tue, 21 Oct 2014 16:15:44 +0200 Subject: [PATCH] API change in mpi: rename allreduce -> all_reduce --- test/triqs/mpi/mpi_array.cpp | 2 +- test/triqs/mpi/mpi_gf.cpp | 2 +- triqs/mpi.hpp | 1 + triqs/mpi/arrays.hpp | 4 ++-- triqs/mpi/base.hpp | 8 ++++---- triqs/mpi/boost.hpp | 2 +- triqs/mpi/gf.hpp | 15 ++++++++------- triqs/mpi/vector.hpp | 6 +++--- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/test/triqs/mpi/mpi_array.cpp b/test/triqs/mpi/mpi_array.cpp index cea0b1b1..70a44ead 100644 --- a/test/triqs/mpi/mpi_array.cpp +++ b/test/triqs/mpi/mpi_array.cpp @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) { out <<" Reduce "<< std::endl; out << " r1 = " << r1 << std::endl; - ARR r2 = mpi::allreduce(A, world); + ARR r2 = mpi::all_reduce(A, world); out <<" AllReduce "<< std::endl; out << " r2 = " << r2 << std::endl; diff --git a/test/triqs/mpi/mpi_gf.cpp b/test/triqs/mpi/mpi_gf.cpp index d60d193a..824ef179 100644 --- a/test/triqs/mpi/mpi_gf.cpp +++ b/test/triqs/mpi/mpi_gf.cpp @@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { { out<< "all reduction "<< std::endl; - gf g2 = mpi::allreduce(g1, world); + gf g2 = mpi::all_reduce(g1, world); out << g2.data()< AUTO_DECL gather(T const &x, communicator c = {}, int root = 0) RETURN(mpi_impl::invoke(tag::gather(), c, x, root)); template - AUTO_DECL allreduce(T const &x, communicator c = {}, int root = 0) RETURN(mpi_impl::invoke(tag::allreduce(), c, x, root)); + AUTO_DECL all_reduce(T const &x, communicator c = {}, int root = 0) RETURN(mpi_impl::invoke(tag::all_reduce(), c, x, root)); template AUTO_DECL allgather(T const &x, communicator c = {}, int root = 0) RETURN(mpi_impl::invoke(tag::allgather(), c, x, root)); @@ -132,7 +132,7 @@ namespace mpi { return b; } - static T invoke(tag::allreduce, communicator c, T a, int root) { + static T invoke(tag::all_reduce, communicator c, T a, int root) { T b; MPI_Allreduce(&a, &b, 1, D(), MPI_SUM, c.get()); return b; @@ -142,7 +142,7 @@ namespace mpi { MPI_Reduce((c.rank() == root ? MPI_IN_PLACE : &a), &a, 1, D(), MPI_SUM, root, c.get()); } - static void allreduce_in_place(communicator c, T &a, int root) { + static void all_reduce_in_place(communicator c, T &a, int root) { MPI_Allreduce(MPI_IN_PLACE, &a, 1, D(), MPI_SUM, root, c.get()); } diff --git a/triqs/mpi/boost.hpp b/triqs/mpi/boost.hpp index 74a76e6a..65da71dc 100644 --- a/triqs/mpi/boost.hpp +++ b/triqs/mpi/boost.hpp @@ -48,7 +48,7 @@ namespace mpi { return b; } - static T invoke(tag::allreduce, communicator c, T const &a, int root) { + static T invoke(tag::all_reduce, communicator c, T const &a, int root) { T b; boost::mpi::all_reduce(c, a, b, std::c14::plus<>()); return b; diff --git a/triqs/mpi/gf.hpp b/triqs/mpi/gf.hpp index a2c1d949..93d624e3 100644 --- a/triqs/mpi/gf.hpp +++ b/triqs/mpi/gf.hpp @@ -20,6 +20,7 @@ ******************************************************************************/ #pragma once #include "./base.hpp" +#include "./arrays.hpp" namespace triqs { namespace mpi { @@ -36,9 +37,9 @@ namespace mpi { } //--------- - /*static void allreduce_in_place(communicator c, G &g, int root) { - triqs::mpi::allreduce_in_place(c, g.data(), root); - triqs::mpi::allreduce_in_place(c, g.singularity(), root); + /*static void all_reduce_in_place(communicator c, G &g, int root) { + triqs::mpi::all_reduce_in_place(c, g.data(), root); + triqs::mpi::all_reduce_in_place(c, g.singularity(), root); } */ @@ -60,10 +61,10 @@ namespace mpi { return target; } - //---- allreduce ---- - static G &complete_operation(G &target, mpi_lazy laz) { - target._data = mpi::allreduce(laz.ref.data(), laz.c, laz.root); - target._singularity = mpi::allreduce(laz.ref.singularity(), laz.c, laz.root); + //---- all_reduce ---- + static G &complete_operation(G &target, mpi_lazy laz) { + target._data = mpi::all_reduce(laz.ref.data(), laz.c, laz.root); + target._singularity = mpi::all_reduce(laz.ref.singularity(), laz.c, laz.root); return target; } diff --git a/triqs/mpi/vector.hpp b/triqs/mpi/vector.hpp index e1ae5007..f9023651 100644 --- a/triqs/mpi/vector.hpp +++ b/triqs/mpi/vector.hpp @@ -33,7 +33,7 @@ namespace mpi { MPI_Reduce((c.rank() == root ? MPI_IN_PLACE : a.data()), a.data(), a.size(), D(), MPI_SUM, root, c.get()); } - static void allreduce_in_place(communicator c, std::vector &a, int root) { + static void all_reduce_in_place(communicator c, std::vector &a, int root) { MPI_Allreduce(MPI_IN_PLACE, a.data(), a.size(), D(), MPI_SUM, root, c.get()); } @@ -52,7 +52,7 @@ namespace mpi { } // ----------- - static std::vector invoke(tag::allreduce, communicator c, std::vector const &a, int root) { + static std::vector invoke(tag::all_reduce, communicator c, std::vector const &a, int root) { std::vector b(a.size()); MPI_Allreduce(a.data(), b.data(), a.size(), D(), MPI_SUM, root, c.get()); return b; @@ -95,7 +95,7 @@ namespace mpi { // ----------- static std::vector invoke(tag::allgather, communicator c, std::vector const &a, int root) { - long size = allreduce(a.size(), c, root); + long size = all_reduce(a.size(), c, root); std::vector b(size); auto recvcounts = std::vector(c.size());