id++;
newResource.nbCores = res.second;
wm.addResource(newResource);
- std::cerr << "Add resource " << newResource.name << " with "
- << newResource.nbCores << " cores." << std::endl;
}
}
{
_type.ignoreResources = false;
_type.name = yacsContainer->getName();
- _type.neededCores = 1; // TODO: use the actual value
+ std::string nb_procs_str = yacsContainer->getProperty("nb_parallel_procs");
+ float needed_cores = 0.0;
+ if(!nb_procs_str.empty())
+ needed_cores = std::stof(nb_procs_str);
+ _type.neededCores = needed_cores;
}
else
{
std::vector< std::pair<std::string,int> > RuntimeForEngineIntegrationTest::getCatalogOfComputeNodes() const
{
- std::vector< std::pair<std::string,int> > result(1);
- std::pair<std::string,int> localhost;
- localhost.first = "localhost";
- localhost.second = 8;
- result[0] = localhost;
- return result;
-// throw Exception("RuntimeForEngineTest::getCatalogOfComputeNodes : not implemented !");
+ return std::vector< std::pair<std::string,int> >();
}
ElementaryNode* RuntimeForEngineIntegrationTest::createNode(const std::string& implementation, const std::string& name)
std::vector< std::pair<std::string,int> > RuntimeForEngineTest::getCatalogOfComputeNodes() const
{
- std::vector< std::pair<std::string,int> > result(1);
- std::pair<std::string,int> localhost;
- localhost.first = "localhost";
- localhost.second = 8;
- result[0] = localhost;
- return result;
-// throw Exception("RuntimeForEngineTest::getCatalogOfComputeNodes : not implemented !");
+ return std::vector< std::pair<std::string,int> >();
}
ElementaryNode* RuntimeForEngineTest::createNode(const string& implementation, const string& name)
DefaultAlgorithm::ResourceLoadInfo::ResourceLoadInfo(const Resource& r)
: _resource(r)
, _load(0.0)
+, _loadCost(0.0)
, _ctypes()
{
}
float DefaultAlgorithm::ResourceLoadInfo::cost
(const ContainerType& ctype)const
{
- return _load * 100.0 / float(_resource.nbCores);
+ return _loadCost * 100.0 / float(_resource.nbCores);
}
unsigned int DefaultAlgorithm::ResourceLoadInfo::alloc
it--;
}
_load += ctype.neededCores;
+ if(ctype.neededCores == 0)
+ _loadCost += COST_FOR_0_CORE_TASKS;
+ else
+ _loadCost += ctype.neededCores;
return it->alloc();
}
(const ContainerType& ctype, int index)
{
_load -= ctype.neededCores;
+ if(ctype.neededCores == 0)
+ _loadCost -= COST_FOR_0_CORE_TASKS;
+ else
+ _loadCost -= ctype.neededCores;
std::list<ResourceInfoForContainer>::iterator it = std::find(_ctypes.begin(),
_ctypes.end(),
ctype);
bool operator==(const Resource& other)const
{ return _resource == other;}
const Resource& resource()const { return _resource;}
+ float COST_FOR_0_CORE_TASKS = 1.0 / 4096.0 ;
private:
Resource _resource;
float _load;
+ float _loadCost;
std::list<ResourceInfoForContainer> _ctypes;
};
#include "../WorkloadManager.hxx"
#include "../DefaultAlgorithm.hxx"
-constexpr bool ACTIVATE_DEBUG_LOG = true;
+constexpr bool ACTIVATE_DEBUG_LOG = false;
template<typename... Ts>
void DEBUG_LOG(Ts... args)
{