#include #include #include #include #include int main(int argc, char * argv[]) { /*Simple general Boost.MPI example*/ /*!MPI initialization*/ boost::mpi::environment env(argc,argv); boost::mpi::communicator world; /*Initialize "global" variables*/ int root=0; /*The process that will do the receiving and output*/ /*Do "the work" (by all processes)*/ /*Waste some time, so that the program takes a noticeable time to finish*/ int length=100000; double atmp[length],btmp[length]; for (int i=0; i proc_names; /*Where the names will go*/ std::vector proc_ranks; /*Where the numbers will go*/ std::string name=boost::mpi::environment::processor_name(); if (world.rank()==root) { /*If root, must provide a place to store the data*/ gather(world,world.rank(),proc_ranks,root); gather(world,name,proc_names,root); } else { /*If not root, just send the data to the gather*/ gather(world,world.rank(),root); gather(world,name,root); } /*Show the results (only the root process does this)*/ if (world.rank()==root) { std::cout<<"I am process number "<