Commit 5d95ac2d authored by BRAMAS Berenger's avatar BRAMAS Berenger

Add a priority system based on heteroprio

parent 9f516fbf
......@@ -20,6 +20,7 @@
#include <starpu.h>
#include "../StarPUUtils/FStarPUUtils.hpp"
#include "../StarPUUtils/FStarPUFmmPriorities.hpp"
#ifdef STARPU_USE_CPU
#include "../StarPUUtils/FStarPUCpuWrapper.hpp"
......@@ -130,7 +131,7 @@ public:
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
// conf.ncpus = MaxThreads;
FStarPUFmmPriorities::Controller().init(&conf, tree->getHeight(), inKernels);
FAssertLF(starpu_init(&conf) == 0);
starpu_pthread_mutex_t initMutex;
......@@ -694,6 +695,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2m_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2M(),
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
STARPU_RW, cellHandles[tree->getHeight()-1][idxGroup].up,
STARPU_R, particleHandles[idxGroup].symb,
......@@ -755,6 +757,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioM2M(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
}
......@@ -774,6 +777,7 @@ protected:
starpu_insert_task(&m2l_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioM2L(idxLevel),
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
STARPU_R, cellHandles[idxLevel][idxGroup].up,
(STARPU_RW|STARPU_COMMUTE), cellHandles[idxLevel][idxGroup].down,
......@@ -791,6 +795,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioM2LExtern(idxLevel),
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
STARPU_R, cellHandles[idxLevel][idxGroup].up,
(STARPU_RW|STARPU_COMMUTE), cellHandles[idxLevel][idxGroup].down,
......@@ -857,6 +862,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioL2L(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
}
......@@ -875,6 +881,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2p_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2P(),
STARPU_R, particleHandles[idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), particleHandles[idxGroup].down,
0);
......@@ -888,6 +895,7 @@ protected:
starpu_insert_task(&p2p_cl_inout,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2PExtern(),
STARPU_R, particleHandles[idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), particleHandles[idxGroup].down,
STARPU_R, particleHandles[interactionid].symb,
......@@ -911,6 +919,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&l2p_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioL2P(),
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].down,
STARPU_R, particleHandles[idxGroup].symb,
......
......@@ -25,6 +25,7 @@
#include <starpu.h>
#include <starpu_mpi.h>
#include "../StarPUUtils/FStarPUUtils.hpp"
#include "../StarPUUtils/FStarPUFmmPriorities.hpp"
#ifdef STARPU_USE_CPU
#include "../StarPUUtils/FStarPUCpuWrapper.hpp"
......@@ -147,7 +148,7 @@ public:
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
//conf.ncpus = MaxThreads;
FStarPUFmmPriorities::Controller().init(&conf, tree->getHeight(), inKernels);
FAssertLF(starpu_init(&conf) == 0);
FAssertLF(starpu_mpi_init ( 0, 0, 0 ) == 0);
......@@ -1281,6 +1282,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2m_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2M(),
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
STARPU_RW, cellHandles[tree->getHeight()-1][idxGroup].up,
STARPU_R, particleHandles[idxGroup].symb,
......@@ -1343,6 +1345,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioM2M(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
......@@ -1422,6 +1425,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioM2M(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
}
......@@ -1481,6 +1485,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioM2LMpi(idxLevel),
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), cellHandles[idxLevel][idxGroup].down,
STARPU_R, remoteCellGroups[idxLevel][interactionid].handleSymb,
......@@ -1505,6 +1510,7 @@ protected:
starpu_insert_task(&m2l_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioM2L(idxLevel),
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
STARPU_R, cellHandles[idxLevel][idxGroup].up,
(STARPU_RW|STARPU_COMMUTE), cellHandles[idxLevel][idxGroup].down,
......@@ -1522,6 +1528,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioM2LExtern(idxLevel),
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
STARPU_R, cellHandles[idxLevel][idxGroup].up,
(STARPU_RW|STARPU_COMMUTE), cellHandles[idxLevel][idxGroup].down,
......@@ -1682,6 +1689,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioL2L(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
}
......@@ -1734,6 +1742,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
task->priority = FStarPUFmmPriorities::Controller().getPrioL2L(idxLevel);
FAssertLF(starpu_task_submit(task) == 0);
}
}
......@@ -1753,6 +1762,7 @@ protected:
starpu_insert_task(&p2p_cl_inout_mpi,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2PMpi(),
STARPU_R, particleHandles[idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), particleHandles[idxGroup].down,
STARPU_R, remoteParticleGroupss[interactionid].handleSymb,
......@@ -1775,6 +1785,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2p_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2P(),
STARPU_R, particleHandles[idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), particleHandles[idxGroup].down,
0);
......@@ -1788,6 +1799,7 @@ protected:
starpu_insert_task(&p2p_cl_inout,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioP2PExtern(),
STARPU_R, particleHandles[idxGroup].symb,
(STARPU_RW|STARPU_COMMUTE), particleHandles[idxGroup].down,
STARPU_R, particleHandles[interactionid].symb,
......@@ -1801,7 +1813,6 @@ protected:
FLOG( FLog::Controller << "\t\t\t inblock in " << timerInBlock.elapsed() << "s\n" );
FLOG( FLog::Controller << "\t\t\t outblock in " << timerOutBlock.elapsed() << "s\n" );
}
/////////////////////////////////////////////////////////////////////////////////////
/// Merge Pass
/////////////////////////////////////////////////////////////////////////////////////
......@@ -1812,6 +1823,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&l2p_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getPrioL2P(),
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].down,
STARPU_R, particleHandles[idxGroup].symb,
......
This diff is collapsed.
......@@ -421,7 +421,7 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id)
assert(bucket->valide_archs & worker->arch_type);
/* Take nb_tasks_to_prefetch tasks if possible */
while(_starpu_fifo_empty(bucket->tasks_queue) == 0 && nb_tasks_to_prefetch
&& (worker->arch_index == bucket->factor_base_arch_index
&& (bucket->factor_base_arch_index == 0 || worker->arch_index == bucket->factor_base_arch_index
|| (float(_starpu_fifo_size(bucket->tasks_queue))/float(heteroprio->nb_workers_per_arch_index[bucket->factor_base_arch_index])
>= bucket->slow_factors_per_index[worker->arch_index]))){
struct starpu_task* task = _starpu_fifo_pop_local_task(bucket->tasks_queue);
......
......@@ -18,10 +18,10 @@ public:
virtual bool supportL2P(const FStarPUTypes inPu) const = 0;
virtual bool supportP2P(const FStarPUTypes inPu) const = 0;
virtual bool supportP2PExtern(const FStarPUTypes inPu) const = 0;
#ifdef SCALFMM_USE_MPI
virtual bool supportM2LMpi(const FStarPUTypes inPu) const = 0;
virtual bool supportP2PMpi(const FStarPUTypes inPu) const = 0;
#endif
};
class FStarPUAbstractCapacities : public FStarPUKernelCapacities {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment