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

Let the Starpu threaded version use real adresse of the data block (as in the...

Let the Starpu threaded version use real adresse of the data block (as in the starpu mpi) but NOT as the omp for now
parent 25601461
......@@ -220,7 +220,8 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbCellGroupAtLevel(idxLevel) ; ++idxGroup){
const CellContainerClass* currentCells = tree->getCellGroup(idxLevel, idxGroup);
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0, (uintptr_t)currentCells, sizeof(*currentCells)); // TODO
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0,
(uintptr_t)currentCells->getRawBuffer(), currentCells->getBufferSizeInByte());
}
}
{
......@@ -228,7 +229,8 @@ protected:
handles[idxLevel].resize(tree->getNbParticleGroup());
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
ParticleGroupClass* containers = tree->getParticleGroup(idxGroup);
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0, (uintptr_t)containers, sizeof(*containers)); // TODO
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0,
(uintptr_t)containers->getRawBuffer(), containers->getBufferSizeInByte());
}
}
}
......@@ -428,12 +430,14 @@ protected:
}
static void bottomPassCallback(void *buffers[], void *cl_arg){
CellContainerClass* leafCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
ParticleGroupClass* containers = reinterpret_cast<ParticleGroupClass*>(STARPU_VARIABLE_GET_PTR(buffers[1]));
CellContainerClass leafCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ParticleGroupClass containers((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[1]));
ThisClass* worker = nullptr;
starpu_codelet_unpack_args(cl_arg, &worker);
worker->bottomPassPerform(leafCells, containers);
worker->bottomPassPerform(&leafCells, &containers);
}
void bottomPassPerform(CellContainerClass* leafCells, ParticleGroupClass* containers){
......@@ -506,7 +510,8 @@ protected:
}
static void upwardPassCallback(void *buffers[], void *cl_arg){
CellContainerClass* currentCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
CellContainerClass currentCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ThisClass* worker = nullptr;
int nbSubCellGroups = 0;
......@@ -516,10 +521,15 @@ protected:
CellContainerClass* subCellGroups[9];
memset(subCellGroups, 0, 9*sizeof(CellContainerClass*));
for(int idxSubGroup = 0; idxSubGroup < nbSubCellGroups ; ++idxSubGroup){
subCellGroups[idxSubGroup] = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[idxSubGroup+1]));
subCellGroups[idxSubGroup] = new CellContainerClass((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[idxSubGroup+1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[idxSubGroup+1]));
}
worker->upwardPassPerform(currentCells, subCellGroups, nbSubCellGroups, idxLevel);
worker->upwardPassPerform(&currentCells, subCellGroups, nbSubCellGroups, idxLevel);
for(int idxSubGroup = 0; idxSubGroup < nbSubCellGroups ; ++idxSubGroup){
delete subCellGroups[idxSubGroup];
}
}
void upwardPassPerform(CellContainerClass*const currentCells,
......@@ -593,13 +603,14 @@ protected:
}
static void transferInPassCallback(void *buffers[], void *cl_arg){
CellContainerClass* currentCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
CellContainerClass currentCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ThisClass* worker = nullptr;
int idxLevel = 0;
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel);
worker->transferInPassPerform(currentCells, idxLevel);
worker->transferInPassPerform(&currentCells, idxLevel);
}
void transferInPassPerform(CellContainerClass*const currentCells, const int idxLevel){
......@@ -638,15 +649,17 @@ protected:
}
static void transferInoutPassCallback(void *buffers[], void *cl_arg){
CellContainerClass* currentCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
CellContainerClass* externalCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[1]));
CellContainerClass currentCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
CellContainerClass externalCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[1]));
ThisClass* worker = nullptr;
int idxLevel = 0;
const std::vector<OutOfBlockInteraction>* outsideInteractions;
starpu_codelet_unpack_args(cl_arg, &worker, &idxLevel, &outsideInteractions);
worker->transferInoutPassPerform(currentCells, externalCells, idxLevel, outsideInteractions);
worker->transferInoutPassPerform(&currentCells, &externalCells, idxLevel, outsideInteractions);
}
......@@ -731,7 +744,8 @@ protected:
}
static void downardPassCallback(void *buffers[], void *cl_arg){
CellContainerClass* currentCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
CellContainerClass currentCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ThisClass* worker = nullptr;
int nbSubCellGroups = 0;
......@@ -741,10 +755,15 @@ protected:
CellContainerClass* subCellGroups[9];
memset(subCellGroups, 0, 9*sizeof(CellContainerClass*));
for(int idxSubGroup = 0; idxSubGroup < nbSubCellGroups ; ++idxSubGroup){
subCellGroups[idxSubGroup] = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[idxSubGroup+1]));
subCellGroups[idxSubGroup] = new CellContainerClass((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[idxSubGroup+1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[idxSubGroup+1]));
}
worker->downardPassPerform(currentCells, subCellGroups, nbSubCellGroups, idxLevel);
worker->downardPassPerform(&currentCells, subCellGroups, nbSubCellGroups, idxLevel);
for(int idxSubGroup = 0; idxSubGroup < nbSubCellGroups ; ++idxSubGroup){
delete subCellGroups[idxSubGroup];
}
}
void downardPassPerform(CellContainerClass*const currentCells,
......@@ -814,12 +833,13 @@ protected:
}
static void directInPassCallback(void *buffers[], void *cl_arg){
ParticleGroupClass* containers = reinterpret_cast<ParticleGroupClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
ParticleGroupClass containers((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ThisClass* worker = nullptr;
starpu_codelet_unpack_args(cl_arg, &worker);
worker->directInPassPerform(containers);
worker->directInPassPerform(&containers);
}
void directInPassPerform(ParticleGroupClass* containers){
......@@ -857,14 +877,16 @@ protected:
}
static void directInoutPassCallback(void *buffers[], void *cl_arg){
ParticleGroupClass* containers = reinterpret_cast<ParticleGroupClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
ParticleGroupClass* externalContainers = reinterpret_cast<ParticleGroupClass*>(STARPU_VARIABLE_GET_PTR(buffers[1]));
ParticleGroupClass containers((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ParticleGroupClass externalContainers((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[1]));
ThisClass* worker = nullptr;
const std::vector<OutOfBlockInteraction>* outsideInteractions = nullptr;
starpu_codelet_unpack_args(cl_arg, &worker, &outsideInteractions);
worker->directInoutPassPerform(containers, externalContainers, outsideInteractions);
worker->directInoutPassPerform(&containers, &externalContainers, outsideInteractions);
}
void directInoutPassPerform(ParticleGroupClass* containers, ParticleGroupClass* containersOther,
......@@ -907,12 +929,14 @@ protected:
}
static void mergePassCallback(void *buffers[], void *cl_arg){
CellContainerClass* leafCells = reinterpret_cast<CellContainerClass*>(STARPU_VARIABLE_GET_PTR(buffers[0]));
ParticleGroupClass* containers = reinterpret_cast<ParticleGroupClass*>(STARPU_VARIABLE_GET_PTR(buffers[1]));
CellContainerClass leafCells((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[0]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[0]));
ParticleGroupClass containers((unsigned char*)STARPU_VARIABLE_GET_PTR(buffers[1]),
STARPU_VARIABLE_GET_ELEMSIZE(buffers[1]));
ThisClass* worker = nullptr;
starpu_codelet_unpack_args(cl_arg, &worker);
worker->mergePassPerform(leafCells, containers);
worker->mergePassPerform(&leafCells, &containers);
}
void mergePassPerform(CellContainerClass* leafCells, ParticleGroupClass* containers){
......
......@@ -733,7 +733,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbCellGroupAtLevel(idxLevel) ; ++idxGroup){
const CellContainerClass* currentCells = tree->getCellGroup(idxLevel, idxGroup);
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0,
(uintptr_t)currentCells->getRawBuffer(), currentCells->getBufferSizeInByte()); // TODO
(uintptr_t)currentCells->getRawBuffer(), currentCells->getBufferSizeInByte());
}
}
{
......@@ -742,7 +742,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
ParticleGroupClass* containers = tree->getParticleGroup(idxGroup);
starpu_variable_data_register(&handles[idxLevel][idxGroup], 0,
(uintptr_t)containers->getRawBuffer(), containers->getBufferSizeInByte()); // TODO
(uintptr_t)containers->getRawBuffer(), containers->getBufferSizeInByte());
}
}
}
......
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