Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f49ddd28 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Improve starpu fmm core

parent b41fbaf5
Branches
Tags
No related merge requests found
// ===================================================================================
// Logiciel initial: ScalFmm Version 0.5
// Co-auteurs : Olivier Coulaud, Bérenger Bramas.
// Propriétaires : INRIA.
// Copyright © 2011-2012, diffusé sous les termes et conditions d’une licence propriétaire.
// Initial software: ScalFmm Version 0.5
// Co-authors: Olivier Coulaud, Bérenger Bramas.
// Owners: INRIA.
// Copyright © 2011-2012, spread under the terms and conditions of a proprietary license.
// ===================================================================================
#ifndef FFMMALGORITHMSTARPU_HPP #ifndef FFMMALGORITHMSTARPU_HPP
#define FFMMALGORITHMSTARPU_HPP #define FFMMALGORITHMSTARPU_HPP
// /!\ Please, you must read the license at the bottom of this page // /!\ Please, you must read the license at the bottom of this page
...@@ -73,10 +83,12 @@ template <class CellClass> ...@@ -73,10 +83,12 @@ template <class CellClass>
class FStarCell : public CellClass{ class FStarCell : public CellClass{
public: public:
/** The handle to register the data */ /** The handle to register the data */
StarHandle handle; StarHandle handleUp;
StarHandle handleDown;
/** Called by fmm starpu to register data */ /** Called by fmm starpu to register data */
void initHandle(){ void initHandle(){
handle.registerVariable( static_cast<CellClass*>(this) ); handleUp.registerVariable( static_cast<CellClass*>(this) );
handleDown.registerVariable( static_cast<CellClass*>(this) );
} }
}; };
...@@ -448,7 +460,7 @@ public: ...@@ -448,7 +460,7 @@ public:
// P2M // P2M
{ {
//kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc()); //kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
starpu_insert_task( &p2m_cl, STARPU_W, octreeIterator.getCurrentCell()->handle.handle, starpu_insert_task( &p2m_cl, STARPU_W, octreeIterator.getCurrentCell()->handleUp.handle,
STARPU_R, octreeIterator.getCurrentLeaf()->getSrc()->handle.handle, 0); STARPU_R, octreeIterator.getCurrentLeaf()->getSrc()->handle.handle, 0);
} }
// P2P // P2P
...@@ -523,14 +535,14 @@ public: ...@@ -523,14 +535,14 @@ public:
// create task // create task
struct starpu_task* const task = starpu_task_create(); struct starpu_task* const task = starpu_task_create();
// buffer 0 is current leaf // buffer 0 is current leaf
task->handles[0] = octreeIterator.getCurrentCell()->handle.handle; task->handles[0] = octreeIterator.getCurrentCell()->handleDown.handle;
// insert other with a mask // insert other with a mask
memset(mask_m2l, 0, sizeof(unsigned int) * 12); memset(mask_m2l, 0, sizeof(unsigned int) * 12);
int idxInsert = 1; int idxInsert = 1;
for(int idxNeigh = 0 ; idxNeigh < 343 ; ++idxNeigh){ for(int idxNeigh = 0 ; idxNeigh < 343 ; ++idxNeigh){
if( neighbors[idxNeigh] ){ if( neighbors[idxNeigh] ){
task->handles[idxInsert++] = neighbors[idxNeigh]->handle.handle; task->handles[idxInsert++] = neighbors[idxNeigh]->handleUp.handle;
mask_m2l[ idxNeigh >> 5 ] = mask_m2l[ idxNeigh >> 5 ] | (1 << (idxNeigh & 0x1F)); mask_m2l[ idxNeigh >> 5 ] = mask_m2l[ idxNeigh >> 5 ] | (1 << (idxNeigh & 0x1F));
} }
} }
...@@ -562,14 +574,14 @@ public: ...@@ -562,14 +574,14 @@ public:
//kernels->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel); //kernels->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
struct starpu_task* const task = starpu_task_create(); struct starpu_task* const task = starpu_task_create();
// buffer 0 is parent cell // buffer 0 is parent cell
task->handles[0] = octreeIterator.getCurrentCell()->handle.handle; task->handles[0] = octreeIterator.getCurrentCell()->handleUp.handle;
// add child with mask // add child with mask
unsigned int mask = 0; unsigned int mask = 0;
int idxInsert = 1; int idxInsert = 1;
CellClass*const*const child = octreeIterator.getCurrentChild(); CellClass*const*const child = octreeIterator.getCurrentChild();
for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){
if(child[idxChild]){ if(child[idxChild]){
task->handles[idxInsert++] = child[idxChild]->handle.handle; task->handles[idxInsert++] = child[idxChild]->handleUp.handle;
mask = mask | (1 << idxChild); mask = mask | (1 << idxChild);
} }
} }
...@@ -600,14 +612,14 @@ public: ...@@ -600,14 +612,14 @@ public:
// create task // create task
struct starpu_task* const task = starpu_task_create(); struct starpu_task* const task = starpu_task_create();
// buffer 0 is current leaf // buffer 0 is current leaf
task->handles[0] = octreeIterator.getCurrentCell()->handle.handle; task->handles[0] = octreeIterator.getCurrentCell()->handleDown.handle;
// insert other with a mask // insert other with a mask
memset(mask_m2l, 0, sizeof(unsigned int) * 12); memset(mask_m2l, 0, sizeof(unsigned int) * 12);
int idxInsert = 1; int idxInsert = 1;
for(int idxNeigh = 0 ; idxNeigh < 343 ; ++idxNeigh){ for(int idxNeigh = 0 ; idxNeigh < 343 ; ++idxNeigh){
if( neighbors[idxNeigh] ){ if( neighbors[idxNeigh] ){
task->handles[idxInsert++] = neighbors[idxNeigh]->handle.handle; task->handles[idxInsert++] = neighbors[idxNeigh]->handleUp.handle;
mask_m2l[ idxNeigh >> 5 ] = mask_m2l[ idxNeigh >> 5 ] | (1 << (idxNeigh & 0x1F)); mask_m2l[ idxNeigh >> 5 ] = mask_m2l[ idxNeigh >> 5 ] | (1 << (idxNeigh & 0x1F));
} }
} }
...@@ -658,14 +670,14 @@ public: ...@@ -658,14 +670,14 @@ public:
//kernels->L2L( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel); //kernels->L2L( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
struct starpu_task* const task = starpu_task_create(); struct starpu_task* const task = starpu_task_create();
// buffer 0 is parent cell // buffer 0 is parent cell
task->handles[0] = octreeIterator.getCurrentCell()->handle.handle; task->handles[0] = octreeIterator.getCurrentCell()->handleDown.handle;
// insert children with mask // insert children with mask
unsigned int mask = 0; unsigned int mask = 0;
int idxInsert = 1; int idxInsert = 1;
CellClass*const*const child = octreeIterator.getCurrentChild(); CellClass*const*const child = octreeIterator.getCurrentChild();
for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){ for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){
if(child[idxChild]){ if(child[idxChild]){
task->handles[idxInsert++] = child[idxChild]->handle.handle; task->handles[idxInsert++] = child[idxChild]->handleDown.handle;
mask = mask | (1 << idxChild); mask = mask | (1 << idxChild);
} }
} }
...@@ -708,7 +720,7 @@ public: ...@@ -708,7 +720,7 @@ public:
octreeIterator.gotoBottomLeft(); octreeIterator.gotoBottomLeft();
do{ do{
//kernels->L2P( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc()); //kernels->L2P( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
starpu_insert_task(&l2p_cl, STARPU_R, octreeIterator.getCurrentCell()->handle.handle, starpu_insert_task(&l2p_cl, STARPU_R, octreeIterator.getCurrentCell()->handleDown.handle,
STARPU_RW, octreeIterator.getCurrentLeaf()->getTargets()->handle.handle, 0); STARPU_RW, octreeIterator.getCurrentLeaf()->getTargets()->handle.handle, 0);
} while(octreeIterator.moveRight()); } while(octreeIterator.moveRight());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment