3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 22:33:48 +01:00
dft_tools/doc/reference/c++/mpi/mpi_0.cpp
2014-10-18 21:19:52 +02:00

31 lines
450 B
C++

#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;
}