3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 14:53:39 +01:00
dft_tools/doc/reference/c++/mpi/mpi_0.cpp

31 lines
450 B
C++
Raw Normal View History

2014-07-16 17:36:46 +02:00
#include <triqs/arrays.hpp>
#include <triqs/mpi.hpp>
#include <iostream>
using namespace triqs;
using namespace triqs::arrays;
using namespace triqs::mpi;
int main(int argc, char *argv[]) {
mpi::environment env(argc, argv);
mpi::communicator world;
int a = 5;
broadcast(a);
reduce_in_place(a);
array<int, 2> A(2,10); A()=1;
std::cout<<A<<std::endl;
scatter(A);
A += world.rank();
gather(A);
std::cout<<A<<std::endl;
return 0;
}