Commit 48b4c296 authored by Berenger Bramas's avatar Berenger Bramas

Merge remote-tracking branch 'origin/simgrid'

parents 64603413 7863df56
......@@ -114,9 +114,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
option( SCALFMM_DISABLE_NATIVE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
endif()
option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
# SIMGRID and peformance models options
option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF )
option( SCALFMM_SIMGRID_TASKNAMEPARAMS "Set to ON to have verbose information in the task name" OFF )
# STARPU options
option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF )
# STARPU options
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF)
......@@ -599,6 +600,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${STARPU_INCLUDE_DIRS}")
endif()
# Adding SimGrid includes
set(SCALFMM_INCLUDES "${SCALFMM_INCLUDES};$ENV{SIMGRID_INCLUDE}")
message(STATUS " Adding SIMGRID = $ENV{SIMGRID_INCLUDE}")
# TODO: replace this by a component of find starpu
OPTION( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF )
MESSAGE( STATUS "SCALFMM_USE_OPENCL = ${SCALFMM_USE_OPENCL}" )
......
#ifndef __STARPU_CODELET_PARAMETERS_H__
#define __STARPU_CODELET_PARAMETERS_H__
#include <starpu.h>
#include "../StarPUUtils/FStarPUUtils.hpp"
#ifdef __cplusplus
extern "C"
{
#endif
/* P2P */
static const char *p2p_cl_in_parameters_names[] = { "NbLeavesBlock", "SizeInterval", "NbParticlesGroup", "NbInteractions" };
static unsigned p2p_cl_in_combi1 [4] = { 0, 0, 1, 0 };
static unsigned p2p_cl_in_combi2 [4] = { 0, 0, 0, 1 };
static unsigned *p2p_cl_in_combinations[] = { p2p_cl_in_combi1, p2p_cl_in_combi2 };
static inline void p2p_cl_in_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
/* P2P_out */
static const char *p2p_cl_inout_parameters_names[] = { "NbLeavesBlock", "SizeInterval", "NbParticlesGroup", "iNbLeavesBlock", "iSizeInterval", "iNBParticlesGroup", "OutsideInteractionsSize", "NbDiff0", "NbDiff1", "NbInteractions" };
static unsigned p2p_cl_inout_combi1 [10] = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi2 [10] = { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi3 [10] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 };
static unsigned p2p_cl_inout_combi4 [10] = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 };
static unsigned p2p_cl_inout_combi5 [10] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
static unsigned p2p_cl_inout_combi6 [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 };
static unsigned p2p_cl_inout_combi7 [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
static unsigned *p2p_cl_inout_combinations[] = { p2p_cl_inout_combi1, p2p_cl_inout_combi2, p2p_cl_inout_combi3, p2p_cl_inout_combi4, p2p_cl_inout_combi5, p2p_cl_inout_combi6, p2p_cl_inout_combi7 };
static inline void p2p_cl_inout_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
std::vector<OutOfBlockInteraction>* outsideInteractions;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&outsideInteractions,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6],
&parameters[7],
&parameters[8],
&parameters[9]);
}
/* P2M */
static const char *p2m_cl_parameters_names[] = { "NbCellsBlock", "SizeInterval", "NbParticlesGroup" };
static unsigned p2m_cl_combi1 [3] = { 0, 0, 1 };
static unsigned *p2m_cl_combinations[] = { p2m_cl_combi1 };
static inline void p2m_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2]);
}
/* M2M */
static const char *m2m_cl_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned m2m_cl_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned m2m_cl_combi2 [7] = { 0, 0, 0, 0, 1, 1, 0 };
static unsigned *m2m_cl_combinations[] = { m2m_cl_combi1, m2m_cl_combi2 };
static inline void m2m_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* M2L */
static const char *m2l_cl_in_parameters_names[] = { "Lvl", "NbLeavesBlock", "SizeInterval", "NbM2LInteractions" };
static unsigned m2l_cl_in_combi1 [4] = { 0, 0, 0, 1 };
static unsigned *m2l_cl_in_combinations[] = { m2l_cl_in_combi1 };
static inline void m2l_cl_in_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
/* M2L_out */
static const char *m2l_cl_inout_parameters_names[] = { "Lvl", "NbLeavesBlock", "SizeInterval", "iNbLeavesBlock", "iSizeInterval", "OutsideInteractionsSize", "NbDiff0", "NbDiff1" };
static unsigned m2l_cl_inout_combi1 [8] = { 0, 0, 0, 0, 0, 1, 0, 0 };
static unsigned m2l_cl_inout_combi2 [8] = { 0, 0, 0, 0, 0, 0, 1, 0 };
static unsigned *m2l_cl_inout_combinations[] = { m2l_cl_inout_combi1, m2l_cl_inout_combi2 };
static inline void m2l_cl_inout_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
const std::vector<OutOfBlockInteraction>* outsideInteractions;
int idxLevel, i, m;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&outsideInteractions,
&i,
&m,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6],
&parameters[7]);
}
/* L2L */
static const char *l2l_cl_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned l2l_cl_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned *l2l_cl_combinations[] = { l2l_cl_combi1 };
static inline void l2l_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* L2L_NOCOMMUTE */
static const char *l2l_cl_nocommute_parameters_names[] = { "Lvl", "NbCellsBlock", "SizeInterval", "NbCellsBlockLvl+1", "SizeIntervalLvl+1", "NbDiff", "NbChildParent" };
static unsigned l2l_cl_nocommute_combi1 [7] = { 0, 0, 0, 0, 0, 1, 0 };
static unsigned *l2l_cl_nocommute_combinations[] = { l2l_cl_nocommute_combi1 };
static inline void l2l_cl_nocommute_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int idxLevel, i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&idxLevel,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3],
&parameters[4],
&parameters[5],
&parameters[6]);
}
/* L2P */
static const char *l2p_cl_parameters_names[] = { "NbCellsBlock", "SizeInterval", "NbParticlesGroup" };
static unsigned l2p_cl_combi1 [3] = { 0, 0, 1 };
static unsigned *l2p_cl_combinations[] = { l2p_cl_combi1 };
static inline void l2p_cl_perf_func(struct starpu_task *task, double *parameters){
FStarPUPtrInterface* wrapperptr;
int i;
starpu_codelet_unpack_args(task->cl_arg,
&wrapperptr,
&i,
&parameters[0],
&parameters[1],
&parameters[2],
&parameters[3]);
}
#ifdef __cplusplus
}
#endif
#endif /* __STARPU_CODELET_PARAMETERS_H__ */
......@@ -102,7 +102,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->bottomPassPerform(&leafCells, &containers);
}
......@@ -132,7 +136,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
CellContainerClass subCellGroup(
(unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]),
......@@ -243,7 +251,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInPassPerform(&currentCells, idxLevel);
}
......@@ -301,7 +313,11 @@ public:
const std::vector<OutOfBlockInteraction>* outsideInteractions;
int intervalSize;
int mode = 0;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions, &intervalSize, &mode, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions, &intervalSize, &mode);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->transferInoutPassPerform(&currentCells, &externalCells, idxLevel, outsideInteractions, mode);
}
......@@ -353,7 +369,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int idxLevel = 0;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &intervalSize);
#endif
CellContainerClass subCellGroup(
(unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[2]),
......@@ -457,7 +477,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInPassPerform(&containers);
}
......@@ -506,7 +530,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
const std::vector<OutOfBlockInteraction>* outsideInteractions = nullptr;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->directInoutPassPerform(&containers, &externalContainers, outsideInteractions);
}
......@@ -547,7 +575,11 @@ public:
FStarPUPtrInterface* worker = nullptr;
int intervalSize;
#ifdef STARPU_SIMGRID_MLR_MODELS
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize, NULL);
#else
starpu_codelet_unpack_args(cl_arg, &worker, &intervalSize);
#endif
worker->get<ThisClass>(FSTARPU_CPU_IDX)->mergePassPerform(&leafCells, &containers);
}
......
......@@ -706,7 +706,7 @@ static struct starpu_task *pop_task_heteroprio_policy(unsigned sched_ctx_id)
if(child_sched_ctx != STARPU_NMAX_SCHED_CTXS){
starpu_sched_ctx_revert_task_counters(sched_ctx_id, task->flops);
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3)
starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx, 1);
starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx, 1, 1);
#else
starpu_sched_ctx_move_task_to_ctx(task, child_sched_ctx);
#endif
......
#ifndef FSTARPUTASKNAMEPARAMS_HPP
#define FSTARPUTASKNAMEPARAMS_HPP
#include "../../Utils/FGlobal.hpp"
#include <list>
#include <cstring>
#include <cstdio>
/**
* This class creates task name for starpu
* it is used for simgrid (to pass task parameters)
*/
class FStarPUTaskNameParams{
protected:
std::list<const char*> names;
FILE* fout;
int taskid;
public:
FStarPUTaskNameParams() : fout(nullptr), taskid(0){
const char* fname = getenv("SCALFMM_SIMGRIDOUT")?getenv("SCALFMM_SIMGRIDOUT"):"/tmp/scalfmm.out";
fout = fopen(fname, "w");
std::cout << "output task name in " << fname << "\n";
}
~FStarPUTaskNameParams(){
fclose(fout);
clear();
}
void clear(){
while(names.size()){
delete[] names.front();
names.pop_front();
}
}
template <typename ... Params>
const char* print(const char key[], const char format[], Params... args ){
const size_t length = 512;
char* name = new char[length+1];
snprintf(name, length, "%s_%d", key, taskid++);
name[length] = '\0';
names.push_back(name);
fprintf(fout, "%s, %d, ", key, taskid);
fprintf(fout, format, args...);
return name;
}
const char* add(const char key[], const char* strToCpy){
const size_t length = 512;
char* name = new char[length+1];
snprintf(name, length, "%s_%d", key, taskid++);
name[length] = '\0';
names.push_back(name);
fprintf(fout, "%s=", name);
fprintf(fout, strToCpy);
return name;
}
};
#endif // FSTARPUTASKNAMEPARAMS_HPP
......@@ -167,6 +167,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_SIMGRID_NODATA
#cmakedefine SCALFMM_SIMGRID_TASKNAMEPARAMS
#cmakedefine STARPU_SIMGRID_MLR_MODELS
#endif // CONFIG_H
This diff is collapsed.
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