this is just a backup commit

This commit is contained in:
Greg Landrum
2009-05-12 05:42:21 +00:00
parent 6e0d5c0e67
commit 95d3bd272a
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
project /RDKit/DemoMPI : requirements <library>/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
: <location>. ;
}

View File

@@ -0,0 +1,44 @@
// $Id$
//
// Copyright (C) 2009 Greg Landrum
// All Rights Reserved
//
#include <RDGeneral/Invariant.h>
#include <GraphMol/RDKitBase.h>
#include <GraphMol/SmilesParse/SmilesParse.h>
#include <GraphMol/SmilesParse/SmilesWrite.h>
#include <RDGeneral/RDLog.h>
#include <vector>
#include <algorithm>
#include <boost/mpi.hpp>
#include <iostream>
#include <cstdlib>
#include <string>
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<unsigned int> 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;
}