/*******************************************************************************
*
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
*
* Copyright (C) 2013 by O. Parcollet
*
* TRIQS is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* TRIQS. If not, see .
*
******************************************************************************/
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include
#include
#include
#include
#include
#include
#include
using namespace triqs;
using namespace triqs::arrays;
using namespace triqs::gfs;
using namespace triqs::clef;
int main(int argc, char* argv[]) {
mpi::environment env(argc, argv);
mpi::communicator world;
std::ofstream out("node" + std::to_string(world.rank()));
double beta = 10;
int Nfreq = 8;
placeholder<0> w_;
auto g1 = gf{{beta, Fermion, Nfreq}, {1, 1}}; // using ARR = array;
g1(w_) << 1 / (w_ + 1);
out << "g1.data" << g1.data() << std::endl;
{
out<< "reduction "<< std::endl;
gf g2 = mpi::reduce(g1, world);
out << g2.data()< g2 = mpi::allreduce(g1, world);
out << g2.data()< g2 = mpi::scatter(g1);
g2(w_) << g2(w_) * (1 + world.rank());
g1 = mpi::allgather(g2);
out << g1.data() << std::endl;
}
{
out << "Building directly scattered, and gather" << std::endl;
auto m = mpi_scatter(gf_mesh{beta, Fermion, Nfreq}, world, 0);
auto g3 = gf{m, {1, 1}};
g3(w_) << 1 / (w_ + 1);
auto g4 = g3;
out<< "chunk ..."<