diff --git a/Code/Demos/RDKit/MPI/Jamfile b/Code/Demos/RDKit/MPI/Jamfile new file mode 100644 index 000000000..bbc541b29 --- /dev/null +++ b/Code/Demos/RDKit/MPI/Jamfile @@ -0,0 +1,19 @@ +project /RDKit/DemoMPI : requirements /mpi//mpi : ; +import mpi ; + +if [ mpi.configured ] +{ +exe rdkexample1 : rdkexample1.cpp /boost/mpi//boost_mpi +RDKLibs +; + +alias RDKLibs : ../../../GraphMol/SmilesParse//SmilesParse + ../../../GraphMol//GraphMol + ../../../DataStructs//DataStructs + ../../../RDGeneral//RDGeneral ../../../Geometry//RDGeometry +; + +install rdkexample1.exe : rdkexample1 + : . ; + +} diff --git a/Code/Demos/RDKit/MPI/rdkexample1.cpp b/Code/Demos/RDKit/MPI/rdkexample1.cpp new file mode 100644 index 000000000..e792c05fa --- /dev/null +++ b/Code/Demos/RDKit/MPI/rdkexample1.cpp @@ -0,0 +1,44 @@ +// $Id$ +// +// Copyright (C) 2009 Greg Landrum +// All Rights Reserved +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace mpi = boost::mpi; + + +int main(int argc, char* argv[]) +{ + mpi::environment env(argc, argv); + mpi::communicator world; + + std::srand(time(0) + world.rank()); + std::string txt(std::rand()%10+1,'C'); + + RDKit::ROMol *m=RDKit::SmilesToMol(txt); + + if (world.rank() == 0) { + std::vector all_vals; + gather(world, m->getNumAtoms(), all_vals, 0); + for (int proc = 0; proc < world.size(); ++proc) + std::cout << "Process #" << proc << " thought of " + << all_vals[proc] << std::endl; + } else { + gather(world, m->getNumAtoms(), 0); + } + delete m; + return 0; +} +