3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 06:14:14 +01:00
dft_tools/test/triqs/parameters/mpi_param.cpp
Olivier Parcollet 4789dccda6 parameters : small details
- an include missing on OS X
- change serialization in the general case where hdf5 can be used,
  (version of hdf5 high enough) to use only one buffer,
  not a buffer per field.
- put back the mpi_param example.
2014-05-21 17:51:40 +02:00

42 lines
817 B
C++

#include <triqs/parameters.hpp>
#include <iostream>
#include <vector>
#include <complex>
#include <string>
#include <boost/mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/serialization/complex.hpp>
using namespace triqs::params;
int main(int argc, char* argv[]) {
boost::mpi::environment env(argc, argv);
boost::mpi::communicator world;
parameters P;
P.add_field("a", 1, "?")
.add_field("d", 2.0, "")
.add_field("s", "", "");
if (world.rank() == 0) {
P["a"] = long(1);
P["d"] = 2.7;
P["s"] = std::string("-14.3");
}
std::cout << "Before bcast rank " << world.rank() << " : " << P << std::endl ;
boost::mpi::broadcast(world,P,0);
std::cout << "After bcast rank " << world.rank() << " : " << P << std::endl ;
return 0;
}