Re: [Denovoassembler-devel] [PATCH] Added an example plugin.
Ray -- Parallel genome assemblies for parallel DNA sequencing
Brought to you by:
sebhtml
From: Sébastien B. <se...@bo...> - 2013-02-03 16:19:18
|
(Please CC denovoassembler-devel) I merged the patch. However, the methods registerPlugin and resolveSymbols should be the two last in the .cpp file of any plugin. I fixed that. Sébastien On 02/02/2013 10:03 PM, Charles Joly Beauparlant wrote: > This plugin comes from RayPlatform-example. > > The example is activated with the -example option. Will work without input sequences. > > Signed-off-by: Charles Joly Beauparlant <Cha...@cr...> > --- > code/application_core/Machine.cpp | 4 +- > code/application_core/Machine.h | 5 +- > code/plugin_Example/Example.cpp | 273 +++++++++++++++++++++++++++ > code/plugin_Example/Example.h | 117 ++++++++++++ > code/plugin_Example/Makefile | 3 + > code/plugin_MachineHelper/MachineHelper.cpp | 64 ++++--- > code/plugin_MachineHelper/MachineHelper.h | 9 +- > 7 files changed, 443 insertions(+), 32 deletions(-) > create mode 100644 code/plugin_Example/Example.cpp > create mode 100644 code/plugin_Example/Example.h > create mode 100644 code/plugin_Example/Makefile > > diff --git a/code/application_core/Machine.cpp b/code/application_core/Machine.cpp > index 704c477..dc5c184 100644 > --- a/code/application_core/Machine.cpp > +++ b/code/application_core/Machine.cpp > @@ -1,6 +1,7 @@ > /* > - Ray > + Ray -- Parallel genome assemblies for parallel DNA sequencing > Copyright (C) 2010, 2011, 2012 Sébastien Boisvert > + Copyright (C) 2013 Charles Joly Beauparlant > > http://DeNovoAssembler.SourceForge.Net/ > > @@ -813,6 +814,7 @@ void Machine::registerPlugins(){ > m_computeCore.registerPlugin(&m_genomeNeighbourhood); > m_computeCore.registerPlugin(&m_ontologyPlugin); > m_computeCore.registerPlugin(&m_mock); > + m_computeCore.registerPlugin(&m_example); > > // resolve the symbols > // this is done here because we want to write a summary for > diff --git a/code/application_core/Machine.h b/code/application_core/Machine.h > index a65a0a5..65ea98c 100644 > --- a/code/application_core/Machine.h > +++ b/code/application_core/Machine.h > @@ -1,6 +1,7 @@ > /* > - Ray > + Ray -- Parallel genome assemblies for parallel DNA sequencing > Copyright (C) 2010, 2011, 2012 Sébastien Boisvert > + Copyright (C) 2013 Charles Joly Beauparlant > > http://DeNovoAssembler.SourceForge.Net/ > > @@ -63,6 +64,7 @@ > #include <code/plugin_GenomeNeighbourhood/GenomeNeighbourhood.h> > #include <code/plugin_GeneOntology/GeneOntology.h> > #include <code/plugin_Mock/Mock.h> > +#include <code/plugin_Example/Example.h> > > > > @@ -159,6 +161,7 @@ class Machine : public MiniRank{ > EdgePurger m_edgePurger; > PhylogenyViewer m_phylogeny; > GeneOntology m_ontologyPlugin; > + Example m_example; > > KmerAcademyBuilder m_kmerAcademyBuilder; > bool m_initialisedAcademy; > diff --git a/code/plugin_Example/Example.cpp b/code/plugin_Example/Example.cpp > new file mode 100644 > index 0000000..d3ee9a4 > --- /dev/null > +++ b/code/plugin_Example/Example.cpp > @@ -0,0 +1,273 @@ > +/* > + Ray -- Parallel genome assemblies for parallel DNA sequencing > + Copyright (C) 2013 Charles Joly Beauparlant > + > + http://DeNovoAssembler.SourceForge.Net/ > + > + This program is free software: you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation, version 3 of the License. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You have received a copy of the GNU General Public License > + along with this program (gpl-3.0.txt). > + see <http://www.gnu.org/licenses/> > + > + This is derived from RayPlatform-example. > + > +*/ > + > +#include "Example.h" > + > +__CreatePlugin(Example); > + > +__CreateMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_A); > +__CreateMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_B); > +__CreateMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_C); > + > +__CreateSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_A); > +__CreateSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_B); > +__CreateSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_C); > + > +__CreateMessageTagAdapter(Example,RAY_MPI_TAG_STOP_AND_DIE); > +__CreateMessageTagAdapter(Example,RAY_MPI_TAG_TIME_BOMB); > + > +Example::Example(){ > + m_doneA=false; > + m_doneB=false; > + m_doneC=false; > +} > + > +void Example::call_RAY_MASTER_MODE_STEP_A(){ > + if(m_doneA==false){ > + m_doneA=true; > + cout<<"Rank "<<m_core->getRank()<<" call_RAY_MASTER_MODE_STEP_A"<<endl; > + > + m_core->getSwitchMan()->openMasterMode(m_core->getOutbox(),m_core->getRank()); > + }else if(m_core->getSwitchMan()->allRanksAreReady()){ > + m_core->getSwitchMan()->closeMasterMode(); > + } > +} > + > +void Example::call_RAY_MASTER_MODE_STEP_B(){ > + if(m_doneB==false){ > + m_doneB=true; > + cout<<"Rank "<<MASTER_RANK<<" call_RAY_MASTER_MODE_STEP_B"<<endl; > + m_core->getSwitchMan()->openMasterMode(m_core->getOutbox(),m_core->getRank()); > + }else if(m_core->getSwitchMan()->allRanksAreReady()){ > + m_core->getSwitchMan()->closeMasterMode(); > + } > +} > + > +void Example::call_RAY_MASTER_MODE_STEP_C(){ > + if(m_doneC==false){ > + m_doneC=true; > + cout<<"Rank "<<MASTER_RANK<<" call_RAY_MASTER_MODE_STEP_C"<<endl; > + m_core->getSwitchMan()->openMasterMode(m_core->getOutbox(),m_core->getRank()); > + }else if(m_core->getSwitchMan()->allRanksAreReady()){ > + m_core->getSwitchMan()->closeMasterMode(); > + } > +} > + > +void Example::call_RAY_SLAVE_MODE_STEP_A(){ > + cout<<"I am "<<m_core->getRank()<<" doing call_RAY_SLAVE_MODE_STEP_A"<<endl; > + > + m_core->getSwitchMan()->closeSlaveModeLocally(m_core->getOutbox(),m_core->getRank()); > +} > + > +void Example::call_RAY_SLAVE_MODE_STEP_B(){ > + cout<<"I am "<<m_core->getRank()<<" doing call_RAY_SLAVE_MODE_STEP_B"<<endl; > + > + m_core->getSwitchMan()->closeSlaveModeLocally(m_core->getOutbox(),m_core->getRank()); > +} > + > +void Example::call_RAY_SLAVE_MODE_STEP_C(){ > + > + cout<<"I am "<<m_core->getRank()<<" doing call_RAY_SLAVE_MODE_STEP_C, now I die"<<endl; > + cout<<"This is over "<<endl; > + > + if(m_core->getRank()==0){ > + uint64_t*buffer=(uint64_t*)m_core->getOutboxAllocator()->allocate(1*sizeof(uint64_t)); > + buffer[0]=100; > + > + // compute the next destination > + Rank destination=m_core->getRank()+1; > + if(destination==m_core->getSize()) > + destination=0; > + > + Message aMessage(buffer,1,destination,RAY_MPI_TAG_TIME_BOMB,m_core->getRank()); > + > + // send the bomb to another rank > + m_core->getOutbox()->push_back(&aMessage); > + } > + > + // do nothing now > + m_core->getSwitchMan()->setSlaveMode(RAY_SLAVE_MODE_DO_NOTHING); > +} > + > +void Example::call_RAY_MPI_TAG_TIME_BOMB(Message*message){ > + uint64_t*buffer=message->getBuffer(); > + > + if(buffer[0]==0){ > + cout<<"The bomb exploded on rank "<<m_core->getRank()<<" !"<<endl; > + > + // kill everyone > + > + m_core->sendEmptyMessageToAll(RAY_MPI_TAG_STOP_AND_DIE); > + }else{ > + uint64_t*bufferOut=(uint64_t*)m_core->getOutboxAllocator()->allocate(1*sizeof(uint64_t)); > + bufferOut[0]=buffer[0]-1; > + > + cout<<"Remaining time before the explosion is "<<bufferOut[0]<<" according to rank "<<m_core->getRank()<<endl; > + > + // compute the next destination > + Rank destination=m_core->getRank()+1; > + if(destination==m_core->getSize()) > + destination=0; > + > + Message aMessage(bufferOut,1,destination,RAY_MPI_TAG_TIME_BOMB,m_core->getRank()); > + > + // send the bomb to another rank > + m_core->getOutbox()->push_back(&aMessage); > + } > +} > + > +void Example::call_RAY_MPI_TAG_STOP_AND_DIE(Message*message){ > + > + cout<<"rank "<<m_core->getRank()<<" received message RAY_MPI_TAG_STOP_AND_DIE, this kills the batman"<<endl; > + > + m_core->stop(); > +} > + > +void Example::registerPlugin(ComputeCore*core){ > + > + /** register the m_plugin with the core **/ > + > + m_plugin=core->allocatePluginHandle(); > + > + core->setPluginName(m_plugin,"Example"); > + core->setPluginDescription(m_plugin,"Minimal plugin example"); > + core->setPluginAuthors(m_plugin,"Charles Joly Beauparlant"); > + core->setPluginLicense(m_plugin,"GNU General Public License version 3"); > + > + // for each master mode, we allocate a handle after that, we register a handler for it > + // > + // allocateMasterModeHandle takes 1 arguments > + // - the plugin handle > + > + RAY_MASTER_MODE_STEP_A=core->allocateMasterModeHandle(m_plugin); > + core->setMasterModeObjectHandler(m_plugin,RAY_MASTER_MODE_STEP_A, > + __GetAdapter(Example,RAY_MASTER_MODE_STEP_A)); > + > + core->setMasterModeSymbol(m_plugin,RAY_MASTER_MODE_STEP_A,"RAY_MASTER_MODE_STEP_A"); > + > + core->setMasterModePublicAccess(m_plugin, RAY_MASTER_MODE_STEP_A); > + > + RAY_MASTER_MODE_STEP_B=core->allocateMasterModeHandle(m_plugin); > + core->setMasterModeObjectHandler(m_plugin,RAY_MASTER_MODE_STEP_B, > + __GetAdapter(Example,RAY_MASTER_MODE_STEP_B)); > + > + core->setMasterModeSymbol(m_plugin,RAY_MASTER_MODE_STEP_B,"RAY_MASTER_MODE_STEP_B"); > + > + RAY_MASTER_MODE_STEP_C=core->allocateMasterModeHandle(m_plugin); > + core->setMasterModeObjectHandler(m_plugin,RAY_MASTER_MODE_STEP_C, > + __GetAdapter(Example,RAY_MASTER_MODE_STEP_C)); > + > + core->setMasterModeSymbol(m_plugin,RAY_MASTER_MODE_STEP_C,"RAY_MASTER_MODE_STEP_C"); > + > + // for each slave mode, we allocate a handle after that, we register a handler for it > + > + RAY_SLAVE_MODE_STEP_A=core->allocateSlaveModeHandle(m_plugin); > + core->setSlaveModeObjectHandler(m_plugin,RAY_SLAVE_MODE_STEP_A, > + __GetAdapter(Example,RAY_SLAVE_MODE_STEP_A)); > + > + core->setSlaveModeSymbol(m_plugin,RAY_SLAVE_MODE_STEP_A,"RAY_SLAVE_MODE_STEP_A"); > + > + RAY_SLAVE_MODE_STEP_B=core->allocateSlaveModeHandle(m_plugin); > + core->setSlaveModeObjectHandler(m_plugin,RAY_SLAVE_MODE_STEP_B, > + __GetAdapter(Example,RAY_SLAVE_MODE_STEP_B)); > + > + core->setSlaveModeSymbol(m_plugin,RAY_SLAVE_MODE_STEP_B,"RAY_SLAVE_MODE_STEP_B"); > + > + RAY_SLAVE_MODE_STEP_C=core->allocateSlaveModeHandle(m_plugin); > + core->setSlaveModeObjectHandler(m_plugin,RAY_SLAVE_MODE_STEP_C, > + __GetAdapter(Example,RAY_SLAVE_MODE_STEP_C)); > + > + core->setSlaveModeSymbol(m_plugin,RAY_SLAVE_MODE_STEP_C,"RAY_SLAVE_MODE_STEP_C"); > + > + RAY_MPI_TAG_START_STEP_A=core->allocateMessageTagHandle(m_plugin); > + core->setMessageTagSymbol(m_plugin, RAY_MPI_TAG_START_STEP_A, "RAY_MPI_TAG_START_STEP_A"); > + RAY_MPI_TAG_START_STEP_B=core->allocateMessageTagHandle(m_plugin); > + core->setMessageTagSymbol(m_plugin, RAY_MPI_TAG_START_STEP_B, "RAY_MPI_TAG_START_STEP_B"); > + RAY_MPI_TAG_START_STEP_C=core->allocateMessageTagHandle(m_plugin); > + core->setMessageTagSymbol(m_plugin, RAY_MPI_TAG_START_STEP_C, "RAY_MPI_TAG_START_STEP_C"); > + > + // now, we register the order of the master modes > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_STEP_A,RAY_MASTER_MODE_STEP_B); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_STEP_B,RAY_MASTER_MODE_STEP_C); > + > + // configure which control message to send given a master mode > + core->setMasterModeToMessageTagSwitch(m_plugin,RAY_MASTER_MODE_STEP_A,RAY_MPI_TAG_START_STEP_A); > + core->setMasterModeToMessageTagSwitch(m_plugin,RAY_MASTER_MODE_STEP_B,RAY_MPI_TAG_START_STEP_B); > + core->setMasterModeToMessageTagSwitch(m_plugin,RAY_MASTER_MODE_STEP_C,RAY_MPI_TAG_START_STEP_C); > + > + // configure which slave mode to set given a message tag > + core->setMessageTagToSlaveModeSwitch(m_plugin,RAY_MPI_TAG_START_STEP_A,RAY_SLAVE_MODE_STEP_A); > + core->setMessageTagToSlaveModeSwitch(m_plugin,RAY_MPI_TAG_START_STEP_B,RAY_SLAVE_MODE_STEP_B); > + core->setMessageTagToSlaveModeSwitch(m_plugin,RAY_MPI_TAG_START_STEP_C,RAY_SLAVE_MODE_STEP_C); > + > + m_core=core; > + > + // configure the two message tags > + RAY_MPI_TAG_TIME_BOMB=core->allocateMessageTagHandle(m_plugin); > + core->setMessageTagObjectHandler(m_plugin,RAY_MPI_TAG_TIME_BOMB, > + __GetAdapter(Example,RAY_MPI_TAG_TIME_BOMB)); > + > + core->setMessageTagSymbol(m_plugin, RAY_MPI_TAG_TIME_BOMB, "RAY_MPI_TAG_TIME_BOMB"); > + > + RAY_MPI_TAG_STOP_AND_DIE=core->allocateMessageTagHandle(m_plugin); > + core->setMessageTagObjectHandler(m_plugin,RAY_MPI_TAG_STOP_AND_DIE, > + __GetAdapter(Example,RAY_MPI_TAG_STOP_AND_DIE)); > + > + core->setMessageTagSymbol(m_plugin, RAY_MPI_TAG_STOP_AND_DIE, "RAY_MPI_TAG_STOP_AND_DIE"); > + > + /* a plugin can share any of its object with other plugins **/ > + /** other plugins have to resolve the symbol. **/ > + void*object=&m_doneA; > + core->setObjectSymbol(m_plugin,object,"BooleanState"); > +} > + > +void Example::resolveSymbols(ComputeCore*core){ > + > + // here, we resolve symbols owned by other m_plugins > + // but needed by the current m_plugin > + // obviously, this is not needed here because > + // we only have one m_plugin > + > + RAY_SLAVE_MODE_STEP_A=core->getSlaveModeFromSymbol(m_plugin,"RAY_SLAVE_MODE_STEP_A"); > + > + // this slave mode is registered somewhere in RayPlatform > + RAY_SLAVE_MODE_DO_NOTHING=core->getSlaveModeFromSymbol(m_plugin,"RAY_SLAVE_MODE_DO_NOTHING"); > + > + bool*example=(bool*) core->getObjectFromSymbol(m_plugin,"BooleanState"); > + > + if(*example) > + *example=false; > + > + __BindPlugin(Example); > + > + __BindAdapter(Example,RAY_MASTER_MODE_STEP_A); > + __BindAdapter(Example,RAY_MASTER_MODE_STEP_B); > + __BindAdapter(Example,RAY_MASTER_MODE_STEP_C); > + > + __BindAdapter(Example,RAY_SLAVE_MODE_STEP_A); > + __BindAdapter(Example,RAY_SLAVE_MODE_STEP_B); > + __BindAdapter(Example,RAY_SLAVE_MODE_STEP_C); > + > + __BindAdapter(Example,RAY_MPI_TAG_STOP_AND_DIE); > + __BindAdapter(Example,RAY_MPI_TAG_TIME_BOMB); > +} > diff --git a/code/plugin_Example/Example.h b/code/plugin_Example/Example.h > new file mode 100644 > index 0000000..01fb444 > --- /dev/null > +++ b/code/plugin_Example/Example.h > @@ -0,0 +1,117 @@ > +/* > + Ray -- Parallel genome assemblies for parallel DNA sequencing > + Copyright (C) 2013 Charles Joly Beauparlant > + > + http://DeNovoAssembler.SourceForge.Net/ > + > + This program is free software: you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation, version 3 of the License. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You have received a copy of the GNU General Public License > + along with this program (gpl-3.0.txt). > + see <http://www.gnu.org/licenses/> > + > + This is derived from RayPlatform-example. > + > +*/ > + > +#ifndef _Example_h > +#define _Example_h > + > +#include <RayPlatform/core/ComputeCore.h> > + > +__DeclarePlugin(Example); > + > +__DeclareMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_A); > +__DeclareMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_B); > +__DeclareMasterModeAdapter(Example,RAY_MASTER_MODE_STEP_C); > + > +__DeclareSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_A); > +__DeclareSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_B); > +__DeclareSlaveModeAdapter(Example,RAY_SLAVE_MODE_STEP_C); > + > +__DeclareMessageTagAdapter(Example,RAY_MPI_TAG_STOP_AND_DIE); > +__DeclareMessageTagAdapter(Example,RAY_MPI_TAG_TIME_BOMB); > + > +/** > + * The plugin Example > + * > + * \author Charles Joly Beauparlant > + **/ > +class Example: public CorePlugin{ > + > + __AddAdapter(Example,RAY_MASTER_MODE_STEP_A); > + __AddAdapter(Example,RAY_MASTER_MODE_STEP_B); > + __AddAdapter(Example,RAY_MASTER_MODE_STEP_C); > + > + __AddAdapter(Example,RAY_SLAVE_MODE_STEP_A); > + __AddAdapter(Example,RAY_SLAVE_MODE_STEP_B); > + __AddAdapter(Example,RAY_SLAVE_MODE_STEP_C); > + > + __AddAdapter(Example,RAY_MPI_TAG_STOP_AND_DIE); > + __AddAdapter(Example,RAY_MPI_TAG_TIME_BOMB); > + > +/** > + * A list of master modes > + */ > + MasterMode RAY_MASTER_MODE_STEP_A; > + MasterMode RAY_MASTER_MODE_STEP_B; > + MasterMode RAY_MASTER_MODE_STEP_C; > + > +/** slave modes **/ > + SlaveMode RAY_SLAVE_MODE_STEP_A; > + SlaveMode RAY_SLAVE_MODE_STEP_B; > + SlaveMode RAY_SLAVE_MODE_STEP_C; > + SlaveMode RAY_SLAVE_MODE_DO_NOTHING; > + > + > + MessageTag RAY_MPI_TAG_START_STEP_A; > + MessageTag RAY_MPI_TAG_START_STEP_B; > + MessageTag RAY_MPI_TAG_START_STEP_C; > + > + MessageTag RAY_MPI_TAG_TIME_BOMB; > + MessageTag RAY_MPI_TAG_STOP_AND_DIE; > + > + ComputeCore*m_core; > + > +/** states for progression **/ > + bool m_doneA; > + bool m_doneB; > + bool m_doneC; > + bool m_doneExample; > + > +/** Example state **/ > + bool m_example; > +public: > + > + Example(); > + > +/** callbacks for master modes **/ > + void call_RAY_MASTER_MODE_STEP_A(); > + void call_RAY_MASTER_MODE_STEP_B(); > + void call_RAY_MASTER_MODE_STEP_C(); > + > +/** callbacks for slave modes **/ > + void call_RAY_SLAVE_MODE_STEP_A(); > + void call_RAY_SLAVE_MODE_STEP_B(); > + void call_RAY_SLAVE_MODE_STEP_C(); > + > + void call_RAY_MPI_TAG_TIME_BOMB(Message*message); > + void call_RAY_MPI_TAG_STOP_AND_DIE(Message*message); > + > +/** the following two methods are required by the interface CorePlugin **/ > + > +/** register the plugin with the core **/ > + void registerPlugin(ComputeCore*core); > + > +/** resolve symbols not owned by the current plugin **/ > + void resolveSymbols(ComputeCore*core); > +}; > + > +#endif > diff --git a/code/plugin_Example/Makefile b/code/plugin_Example/Makefile > new file mode 100644 > index 0000000..50b1ba4 > --- /dev/null > +++ b/code/plugin_Example/Makefile > @@ -0,0 +1,3 @@ > +Example-y += code/plugin_Example/Example.o > + > +obj-y += $(Example-y) > diff --git a/code/plugin_MachineHelper/MachineHelper.cpp b/code/plugin_MachineHelper/MachineHelper.cpp > index fbe52a5..04ec687 100644 > --- a/code/plugin_MachineHelper/MachineHelper.cpp > +++ b/code/plugin_MachineHelper/MachineHelper.cpp > @@ -1,6 +1,7 @@ > /* > - Ray > - Copyright (C) 2012 Sébastien Boisvert > + Ray -- Parallel genome assemblies for parallel DNA sequencing > + Copyright (C) 2010, 2011, 2012 Sébastien Boisvert > + Copyright (C) 2013 Charles Joly Beauparlant > > http://DeNovoAssembler.SourceForge.Net/ > > @@ -1225,6 +1226,7 @@ void MachineHelper::resolveSymbols(ComputeCore*core){ > RAY_MASTER_MODE_UPDATE_DISTANCES=core->getMasterModeFromSymbol(m_plugin,"RAY_MASTER_MODE_UPDATE_DISTANCES"); > RAY_MASTER_MODE_WRITE_KMERS=core->getMasterModeFromSymbol(m_plugin,"RAY_MASTER_MODE_WRITE_KMERS"); > RAY_MASTER_MODE_WRITE_SCAFFOLDS=core->getMasterModeFromSymbol(m_plugin,"RAY_MASTER_MODE_WRITE_SCAFFOLDS"); > + RAY_MASTER_MODE_STEP_A=core->getMasterModeFromSymbol(m_plugin,"RAY_MASTER_MODE_STEP_A"); > > RAY_MPI_TAG_FINISH_FUSIONS=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_FINISH_FUSIONS"); > RAY_MPI_TAG_GET_CONTIG_CHUNK=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_GET_CONTIG_CHUNK"); > @@ -1312,31 +1314,13 @@ void MachineHelper::resolveSymbols(ComputeCore*core){ > RAY_MPI_TAG_SET_FILE_ENTRIES=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_SET_FILE_ENTRIES"); > RAY_MPI_TAG_SET_FILE_ENTRIES_REPLY=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_SET_FILE_ENTRIES_REPLY"); > > - core->setFirstMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_CONFIG); > - > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_CONFIG, RAY_MASTER_MODE_TEST_NETWORK); > - > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_SEEDING,RAY_MASTER_MODE_TRIGGER_SEEDING); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_SEEDING,RAY_MASTER_MODE_START_UPDATING_DISTANCES); > - > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_SEQUENCES,RAY_MASTER_MODE_TRIGGER_VERTICE_DISTRIBUTION); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_VERTICE_DISTRIBUTION,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS_WITH_ANSWERS); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS_WITH_ANSWERS,RAY_MASTER_MODE_SEND_COVERAGE_VALUES); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_SEND_COVERAGE_VALUES,RAY_MASTER_MODE_TRIGGER_GRAPH_BUILDING); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_GRAPH_BUILDING,RAY_MASTER_MODE_PURGE_NULL_EDGES); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PURGE_NULL_EDGES,RAY_MASTER_MODE_WRITE_KMERS); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_WRITE_KMERS,RAY_MASTER_MODE_TRIGGER_INDEXING); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_INDEXING,RAY_MASTER_MODE_PREPARE_SEEDING); > - > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_START_UPDATING_DISTANCES,RAY_MASTER_MODE_UPDATE_DISTANCES); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_FUSIONS,RAY_MASTER_MODE_TRIGGER_FIRST_FUSIONS); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_FIRST_FUSIONS,RAY_MASTER_MODE_START_FUSION_CYCLE); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_START_FUSION_CYCLE,RAY_MASTER_MODE_ASK_EXTENSIONS); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_ASK_EXTENSIONS,RAY_MASTER_MODE_SCAFFOLDER); > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_SCAFFOLDER,RAY_MASTER_MODE_WRITE_SCAFFOLDS); > - > - core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_KILL_RANKS,RAY_MASTER_MODE_KILL_ALL_MPI_RANKS); > + if (m_parameters->hasOption("-example")) { > + cout << "************** Example Mode **************" << endl; > + core->setFirstMasterMode(m_plugin, RAY_MASTER_MODE_STEP_A); > + } > + else { > + performAssemblyWorkflow(core); > + } > > RAY_MPI_TAG_GOOD_JOB_SEE_YOU_SOON=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_GOOD_JOB_SEE_YOU_SOON"); > RAY_MPI_TAG_GOOD_JOB_SEE_YOU_SOON_REPLY=core->getMessageTagFromSymbol(m_plugin,"RAY_MPI_TAG_GOOD_JOB_SEE_YOU_SOON_REPLY"); > @@ -1382,4 +1366,30 @@ void MachineHelper::resolveSymbols(ComputeCore*core){ > m_startedToSendCounts=false; > } > > +void MachineHelper::performAssemblyWorkflow(ComputeCore*core) { > + core->setFirstMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_CONFIG); > + > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_CONFIG, RAY_MASTER_MODE_TEST_NETWORK); > + > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_SEEDING,RAY_MASTER_MODE_TRIGGER_SEEDING); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_SEEDING,RAY_MASTER_MODE_START_UPDATING_DISTANCES); > + > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_LOAD_SEQUENCES,RAY_MASTER_MODE_TRIGGER_VERTICE_DISTRIBUTION); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_VERTICE_DISTRIBUTION,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS_WITH_ANSWERS); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PREPARE_DISTRIBUTIONS_WITH_ANSWERS,RAY_MASTER_MODE_SEND_COVERAGE_VALUES); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_SEND_COVERAGE_VALUES,RAY_MASTER_MODE_TRIGGER_GRAPH_BUILDING); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_GRAPH_BUILDING,RAY_MASTER_MODE_PURGE_NULL_EDGES); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_PURGE_NULL_EDGES,RAY_MASTER_MODE_WRITE_KMERS); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_WRITE_KMERS,RAY_MASTER_MODE_TRIGGER_INDEXING); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_INDEXING,RAY_MASTER_MODE_PREPARE_SEEDING); > + > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_START_UPDATING_DISTANCES,RAY_MASTER_MODE_UPDATE_DISTANCES); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_FUSIONS,RAY_MASTER_MODE_TRIGGER_FIRST_FUSIONS); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_TRIGGER_FIRST_FUSIONS,RAY_MASTER_MODE_START_FUSION_CYCLE); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_START_FUSION_CYCLE,RAY_MASTER_MODE_ASK_EXTENSIONS); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_ASK_EXTENSIONS,RAY_MASTER_MODE_SCAFFOLDER); > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_SCAFFOLDER,RAY_MASTER_MODE_WRITE_SCAFFOLDS); > > + core->setMasterModeNextMasterMode(m_plugin,RAY_MASTER_MODE_KILL_RANKS,RAY_MASTER_MODE_KILL_ALL_MPI_RANKS); > +} > diff --git a/code/plugin_MachineHelper/MachineHelper.h b/code/plugin_MachineHelper/MachineHelper.h > index c58e680..c2b94d6 100644 > --- a/code/plugin_MachineHelper/MachineHelper.h > +++ b/code/plugin_MachineHelper/MachineHelper.h > @@ -1,6 +1,7 @@ > /* > - Ray > - Copyright (C) 2012 Sébastien Boisvert > + Ray -- Parallel genome assemblies for parallel DNA sequencing > + Copyright (C) 2010, 2011, 2012 Sébastien Boisvert > + Copyright (C) 2013 Charles Joly Beauparlant > > http://DeNovoAssembler.SourceForge.Net/ > > @@ -24,6 +25,7 @@ > #include <code/plugin_Mock/Parameters.h> > #include <code/plugin_FusionData/FusionData.h> > #include <code/plugin_NetworkTest/NetworkTest.h> > +#include <code/plugin_Example/Example.h> > #include <code/plugin_Partitioner/Partitioner.h> > #include <code/plugin_SequencesLoader/SequencesLoader.h> > #include <code/plugin_SeedingData/SeedingData.h> > @@ -251,6 +253,7 @@ class MachineHelper: public CorePlugin{ > MasterMode RAY_MASTER_MODE_UPDATE_DISTANCES; > MasterMode RAY_MASTER_MODE_WRITE_KMERS; > MasterMode RAY_MASTER_MODE_WRITE_SCAFFOLDS; > + MasterMode RAY_MASTER_MODE_STEP_A; > > SlaveMode RAY_SLAVE_MODE_EXTENSION; > SlaveMode RAY_SLAVE_MODE_ADD_COLORS; > @@ -359,7 +362,7 @@ class MachineHelper: public CorePlugin{ > > int getRank(); > int getSize(); > - > + void performAssemblyWorkflow(ComputeCore*core); > > public: > void constructor(int argc,char**argv,Parameters*parameters, > |