Commit dd53bfe9 authored by BRAMAS Berenger's avatar BRAMAS Berenger

provide a way to use the same priorities than OpenMP4 - in this case the...

provide a way to use the same priorities than OpenMP4 - in this case the scheduler is controlled by usual starpu mechanism (env variable)
parent f592a96f
......@@ -91,6 +91,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
option( SCALFMM_STARPU_USE_COMMUTE "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_USE_REDUX "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_USE_PRIO "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF )
endif()
message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" )
if( SCALFMM_USE_MPI )
......
......@@ -161,7 +161,7 @@ public:
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
FStarPUFmmPriorities::Controller().init(&conf, tree->getHeight(), inKernels);
#endif
FAssertLF(starpu_init(&conf) == 0);
......@@ -920,7 +920,7 @@ protected:
starpu_insert_task(&p2m_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2M(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -977,7 +977,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1012,7 +1012,7 @@ protected:
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1041,7 +1041,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2L(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1068,7 +1068,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1087,7 +1087,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][interactionid].symb,
......@@ -1153,7 +1153,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1191,7 +1191,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1221,7 +1221,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2PExtern(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -1248,7 +1248,7 @@ protected:
starpu_insert_task(&p2p_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2P(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -1281,7 +1281,7 @@ protected:
starpu_insert_task(&l2p_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -1310,7 +1310,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2p_redux_read,
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, particleHandles[idxGroup].down,
......
......@@ -175,7 +175,7 @@ public:
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
FStarPUFmmPriorities::Controller().init(&conf, tree->getHeight(), inKernels);
#endif
FAssertLF(starpu_init(&conf) == 0);
......@@ -1527,7 +1527,7 @@ protected:
starpu_insert_task(&p2m_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2M(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -1584,7 +1584,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1618,7 +1618,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1705,7 +1705,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1773,7 +1773,7 @@ protected:
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1805,7 +1805,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2L(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1833,7 +1833,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1852,7 +1852,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][interactionid].symb,
......@@ -2007,7 +2007,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2040,7 +2040,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2092,7 +2092,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2125,7 +2125,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2152,7 +2152,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2PExtern(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2185,7 +2185,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2PExtern(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2212,7 +2212,7 @@ protected:
starpu_insert_task(&p2p_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2P(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2243,7 +2243,7 @@ protected:
starpu_insert_task(&l2p_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -2272,7 +2272,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2p_redux_read,
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, particleHandles[idxGroup].down,
......
......@@ -374,13 +374,25 @@ public:
}
};
#else // STARPU_SUPPORT_SCHEDULER
#elif defined(SCALFMM_STARPU_USE_PRIO)// STARPU_SUPPORT_SCHEDULER
class FStarPUFmmPriorities{
static FStarPUFmmPriorities controller;
enum Priorities{
Prio_P2M = 9 - 5,
Prio_M2M = 8 - 5,
Prio_M2L_High = 7 - 5,
Prio_L2L = 6 - 5,
Prio_P2P_Big = 5 - 5,
Prio_M2L = 4 - 5,
Prio_L2P = 3 - 5,
Prio_P2P_Small = 2 - 5
};
FStarPUFmmPriorities(){
int treeHeight;
FStarPUFmmPriorities() : treeHeight(0){
}
public:
......@@ -389,44 +401,44 @@ public:
}
void init(struct starpu_conf* /*conf*/, const int /*inTreeHeight*/,
void init(struct starpu_conf* /*conf*/, const int inTreeHeight,
FStarPUKernelCapacities* /*inCapacities*/){
treeHeight = inTreeHeight;
}
int getInsertionPosP2M() const {
return 0;
return Prio_P2M;
}
int getInsertionPosM2M(const int /*inLevel*/) const {
return 0;
return Prio_M2M;
}
int getInsertionPosP2M(bool willBeSend) const {
return 0;
int getInsertionPosP2M(bool /*willBeSend*/) const {
return Prio_P2M;
}
int getInsertionPosM2M(const int /*inLevel*/, bool willBeSend) const {
return 0;
int getInsertionPosM2M(const int /*inLevel*/, bool /*willBeSend*/) const {
return Prio_M2M;
}
int getInsertionPosM2L(const int inLevel) const {
return 0;
return inLevel == treeHeight-1 ? Prio_M2L: Prio_M2L_High;
}
int getInsertionPosM2LExtern(const int inLevel) const {
return 0;
return inLevel == treeHeight-1 ? Prio_M2L : Prio_M2L_High;
}
int getInsertionPosL2L(const int inLevel) const {
return 0;
int getInsertionPosL2L(const int /*inLevel*/) const {
return Prio_L2L;
}
int getInsertionPosL2P() const {
return 0;
return Prio_L2P;
}
int getInsertionPosP2P() const {
return 0;
return Prio_P2P_Big;
}
int getInsertionPosP2PExtern() const {
return 0;
return Prio_P2P_Small;
}
};
#endif // STARPU_SUPPORT_SCHEDULER
#endif // SCALFMM_STARPU_USE_PRIO - STARPU_SUPPORT_SCHEDULER
FStarPUFmmPriorities FStarPUFmmPriorities::controller;
......
......@@ -24,7 +24,7 @@
#warning StarPU Arbiter is not supported
#endif
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3) && defined(SCALFMM_STARPU_USE_PRIO)
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3) && defined(SCALFMM_STARPU_USE_PRIO) && !defined(SCALFMM_STARPU_FORCE_NO_SCHEDULER)
#define STARPU_SUPPORT_SCHEDULER
#else
#warning Scheduler is not supported
......
......@@ -150,5 +150,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
#cmakedefine SCALFMM_STARPU_USE_COMMUTE
#cmakedefine SCALFMM_STARPU_USE_REDUX
#cmakedefine SCALFMM_STARPU_USE_PRIO
#cmakedefine SCALFMM_STARPU_FORCE_NO_SCHEDULER
#endif // CONFIG_H
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