mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
this is just a backup commit
This commit is contained in:
19
Code/Demos/RDKit/MPI/Jamfile
Normal file
19
Code/Demos/RDKit/MPI/Jamfile
Normal 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>. ;
|
||||
|
||||
}
|
||||
44
Code/Demos/RDKit/MPI/rdkexample1.cpp
Normal file
44
Code/Demos/RDKit/MPI/rdkexample1.cpp
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user