-// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "Visitor.hxx"
#include "ForEachLoop.hxx"
#include "InlineNode.hxx"
+#include "ServiceNode.hxx"
+#include "ServerNode.hxx"
#include "HomogeneousPoolContainer.hxx"
using namespace YACS::ENGINE;
if(_lev==0)
_max_lev=0;
}
+ void visitForEachLoopDyn(ForEachLoopDyn *node) { throw YACS::Exception(MSG); }
void visitOptimizerLoop(OptimizerLoop *node) { throw YACS::Exception(MSG); }
void visitDynParaLoop(DynParaLoop *node) { throw YACS::Exception(MSG); }
void visitForLoop(ForLoop *node) { throw YACS::Exception(MSG); }
if(!cont2)
return ;
_cont.push_back(cont2);
- HomogeneousPoolContainer *cont3(cont2->getDirectFather());
- if(cont3)
- _cont2.insert(cont3);
+ _cont2.insert(cont2);
}
void visitInlineFuncNode(InlineFuncNode *node) { throw YACS::Exception(MSG); }
void visitLoop(Loop *node) { throw YACS::Exception(MSG); }
int _lev;
int _max_lev;
};
- YACS::BASES::AutoRefCnt<PartDefinition> pd(new AllPartDefinition(pg,1));
+ YACS::BASES::AutoRefCnt<PartDefinition> pd(new AllPartDefinition(pg));
std::map<ComposedNode *,YACS::BASES::AutoRefCnt<PartDefinition> > zeMap;
+ MyVisitor vis(this);
+ this->accept(&vis);
+ for(std::list<ForEachLoop *>::const_iterator it=vis._fes.begin();it!=vis._fes.end();it++)
+ (*it)->edGetNbOfBranchesPort()->edInit(1);
this->removeRecursivelyRedundantCL();
+ if (this->getMaxLevelOfParallelism() > pg->getNumberOfCoresAvailable())
+ throw YACS::Exception("Bloc::fitToPlayGround : Not enough cores available to run the calculation !");
this->partitionRegardingDPL(pd,zeMap);
- MyVisitor vis(this);
this->accept(&vis);
for(std::list<ForEachLoop *>::const_iterator it=vis._fes.begin();it!=vis._fes.end();it++)
{
}
for(std::set< HomogeneousPoolContainer * >::const_iterator it=vis._cont2.begin();it!=vis._cont2.end();it++)
(*it)->setSizeOfPool(pg->getNumberOfWorkers((*it)->getNumberOfCoresPerWorker()));
- for(std::list< HomogeneousPoolContainer *>::const_iterator it=vis._cont.begin();it!=vis._cont.end();it++)
- (*it)->prepareMaskForExecution();
+ //FIXME
}
+
+constexpr char MSG[]="Bloc::propagePlayGround : Not implemented yet for this type of node !";
+class MyVisitorPropagate : public Visitor
+ {
+ public:
+ MyVisitorPropagate(ComposedNode *root):Visitor(root) { }
+ void visitBloc(Bloc *node) { node->ComposedNode::accept(this); }
+ void visitElementaryNode(ElementaryNode *node) { }
+ void visitForEachLoop(ForEachLoop *node) { node->ComposedNode::accept(this); }
+ void visitForEachLoopDyn(ForEachLoopDyn *node) { node->ComposedNode::accept(this); }
+ void visitOptimizerLoop(OptimizerLoop *node) { throw YACS::Exception(MSG); }
+ void visitDynParaLoop(DynParaLoop *node) { throw YACS::Exception(MSG); }
+ void visitForLoop(ForLoop *node) { throw YACS::Exception(MSG); }
+ template<class NodeClass>
+ void visitNodeWithContainer(NodeClass *node)
+ {
+ Container *cont(node->getContainer());
+ HomogeneousPoolContainer *cont2(dynamic_cast<HomogeneousPoolContainer *>(cont));
+ if(!cont2)
+ return ;
+ _cont2.insert(cont2);
+ }
+ void visitInlineNode(InlineNode *node) { this->visitNodeWithContainer<InlineNode>(node); }
+ void visitInlineFuncNode(InlineFuncNode *node) { visitInlineNode(node); }
+ void visitLoop(Loop *node) { throw YACS::Exception(MSG); }
+ void visitProc(Proc *node) { node->ComposedNode::accept(this); }
+ void visitServiceNode(ServiceNode *node) { this->visitNodeWithContainer<ServiceNode>(node); }
+ void visitServerNode(ServerNode *node) { visitInlineNode(node); }
+ void visitServiceInlineNode(ServiceInlineNode *node) { throw YACS::Exception(MSG); }
+ void visitSwitch(Switch *node) { throw YACS::Exception(MSG); }
+ void visitWhileLoop(WhileLoop *node) { throw YACS::Exception(MSG); }
+ void visitPresetNode(DataNode *node) { throw YACS::Exception(MSG); }
+ void visitOutNode(DataNode *node) { throw YACS::Exception(MSG); }
+ void visitStudyInNode(DataNode *node) { throw YACS::Exception(MSG); }
+ void visitStudyOutNode(DataNode *node) { throw YACS::Exception(MSG); }
+ public:
+ std::set< HomogeneousPoolContainer * > _cont2;
+};
+
+void Bloc::propagePlayGround(const PlayGround *pg)
+{
+ MyVisitorPropagate vis(this);
+ this->accept(&vis);
+ for(auto cont : vis._cont2)
+ cont->assignPG(pg);
+}
\ No newline at end of file