Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
48d763c1
Commit
48d763c1
authored
Apr 27, 2015
by
BRAMAS Berenger
Browse files
The block algorithms are now able to work on specific level
parent
64e09b61
Changes
5
Hide whitespace changes
Inline
Side-by-side
Src/GroupTree/Core/FGroupSeqAlgorithm.hpp
View file @
48d763c1
...
...
@@ -17,7 +17,7 @@
#include
<vector>
template
<
class
OctreeClass
,
class
CellContainerClass
,
class
CellClass
,
class
KernelClass
,
class
ParticleGroupClass
,
class
ParticleContainerClass
>
class
FGroupSeqAlgorithm
{
class
FGroupSeqAlgorithm
:
public
FAbstractAlgorithm
{
protected:
const
int
MaxThreads
;
//< The number of threads
OctreeClass
*
const
tree
;
//< The Tree
...
...
@@ -28,13 +28,19 @@ public:
FAssertLF
(
tree
,
"tree cannot be null"
);
FAssertLF
(
kernels
,
"kernels cannot be null"
);
FAbstractAlgorithm
::
setNbLevelsInTree
(
tree
->
getHeight
());
FLOG
(
FLog
::
Controller
<<
"FGroupSeqAlgorithm (Max Thread "
<<
MaxThreads
<<
")
\n
"
);
}
~
FGroupSeqAlgorithm
(){
}
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
protected:
/**
* Runs the complete algorithm.
*/
void
executeCore
(
const
unsigned
operationsToProceed
)
override
{
FLOG
(
FLog
::
Controller
<<
"
\t
Start FGroupSeqAlgorithm
\n
"
);
if
(
operationsToProceed
&
FFmmP2M
)
bottomPass
();
...
...
@@ -48,7 +54,6 @@ public:
if
(
(
operationsToProceed
&
FFmmP2P
)
||
(
operationsToProceed
&
FFmmL2P
)
)
directPass
();
}
protected:
void
bottomPass
(){
FLOG
(
FTic
timer
;
);
typename
OctreeClass
::
ParticleGroupIterator
iterParticles
=
tree
->
leavesBegin
();
...
...
@@ -83,7 +88,7 @@ protected:
void
upwardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
2
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FMath
::
Min
(
tree
->
getHeight
()
-
2
,
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
)
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
@@ -133,7 +138,7 @@ protected:
void
transferPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
@@ -238,7 +243,7 @@ protected:
void
downardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
2
;
idxLevel
<=
tree
->
getHeight
()
-
2
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
Src/GroupTree/Core/FGroupTaskAlgorithm.hpp
View file @
48d763c1
...
...
@@ -19,7 +19,7 @@
#include
<omp.h>
template
<
class
OctreeClass
,
class
CellContainerClass
,
class
CellClass
,
class
KernelClass
,
class
ParticleGroupClass
,
class
ParticleContainerClass
>
class
FGroupTaskAlgorithm
{
class
FGroupTaskAlgorithm
:
public
FAbstractAlgorithm
{
protected:
template
<
class
OtherBlockClass
>
struct
BlockInteractions
{
...
...
@@ -40,6 +40,8 @@ public:
FAssertLF
(
tree
,
"tree cannot be null"
);
FAssertLF
(
inKernels
,
"kernels cannot be null"
);
FAbstractAlgorithm
::
setNbLevelsInTree
(
tree
->
getHeight
());
kernels
=
new
KernelClass
*
[
MaxThreads
];
#pragma omp parallel for schedule(static) num_threads(MaxThreads)
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
@@ -61,7 +63,11 @@ public:
delete
[]
kernels
;
}
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
protected:
/**
* Runs the complete algorithm.
*/
void
executeCore
(
const
unsigned
operationsToProceed
)
override
{
FLOG
(
FLog
::
Controller
<<
"
\t
Start FGroupTaskAlgorithm
\n
"
);
#pragma omp parallel num_threads(MaxThreads)
...
...
@@ -101,7 +107,6 @@ public:
}
}
protected:
/**
* This function is creating the interactions vector between blocks.
* It fills externalInteractionsAllLevel and externalInteractionsLeafLevel.
...
...
@@ -308,7 +313,7 @@ protected:
void
upwardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
2
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FMath
::
Min
(
tree
->
getHeight
()
-
2
,
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
)
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
@@ -388,7 +393,7 @@ protected:
void
transferPass
(){
FLOG
(
FTic
timer
;
);
FLOG
(
FTic
timerInBlock
;
FTic
timerOutBlock
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
FLOG
(
timerInBlock
.
tic
()
);
{
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
...
...
@@ -499,7 +504,7 @@ protected:
void
downardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
2
;
idxLevel
<=
tree
->
getHeight
()
-
2
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
Src/GroupTree/Core/FGroupTaskDepAlgorithm.hpp
View file @
48d763c1
...
...
@@ -21,7 +21,7 @@
template
<
class
OctreeClass
,
class
CellContainerClass
,
class
CellClass
,
class
SymboleCellClass
,
class
PoleCellClass
,
class
LocalCellClass
,
class
KernelClass
,
class
ParticleGroupClass
,
class
ParticleContainerClass
>
class
FGroupTaskDepAlgorithm
{
class
FGroupTaskDepAlgorithm
:
public
FAbstractAlgorithm
{
protected:
template
<
class
OtherBlockClass
>
struct
BlockInteractions
{
...
...
@@ -42,6 +42,8 @@ public:
FAssertLF
(
tree
,
"tree cannot be null"
);
FAssertLF
(
inKernels
,
"kernels cannot be null"
);
FAbstractAlgorithm
::
setNbLevelsInTree
(
tree
->
getHeight
());
kernels
=
new
KernelClass
*
[
MaxThreads
];
#pragma omp parallel for schedule(static) num_threads(MaxThreads)
for
(
int
idxThread
=
0
;
idxThread
<
MaxThreads
;
++
idxThread
){
...
...
@@ -63,7 +65,11 @@ public:
delete
[]
kernels
;
}
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
protected:
/**
* Runs the complete algorithm.
*/
void
executeCore
(
const
unsigned
operationsToProceed
)
override
{
FLOG
(
FLog
::
Controller
<<
"
\t
Start FGroupTaskDepAlgorithm
\n
"
);
#pragma omp parallel num_threads(MaxThreads)
...
...
@@ -96,7 +102,7 @@ public:
}
}
protected:
/**
* This function is creating the interactions vector between blocks.
* It fills externalInteractionsAllLevel and externalInteractionsLeafLevel.
...
...
@@ -304,7 +310,7 @@ protected:
void
upwardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
2
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FMath
::
Min
(
tree
->
getHeight
()
-
2
,
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
)
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
@@ -388,7 +394,7 @@ protected:
void
transferPass
(){
FLOG
(
FTic
timer
;
);
FLOG
(
FTic
timerInBlock
;
FTic
timerOutBlock
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
FLOG
(
timerInBlock
.
tic
()
);
{
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
...
...
@@ -502,7 +508,7 @@ protected:
void
downardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
2
;
idxLevel
<=
tree
->
getHeight
()
-
2
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
typename
OctreeClass
::
CellGroupIterator
iterCells
=
tree
->
cellsBegin
(
idxLevel
);
const
typename
OctreeClass
::
CellGroupIterator
endCells
=
tree
->
cellsEnd
(
idxLevel
);
...
...
Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp
View file @
48d763c1
...
...
@@ -48,7 +48,7 @@ template <class OctreeClass, class CellContainerClass, class KernelClass, class
,
class
StarPUOpenClWrapperClass
=
FStarPUOpenClWrapper
<
KernelClass
,
FOpenCLDeviceWrapper
<
KernelClass
>>
#endif
>
class
FGroupTaskStarPUAlgorithm
{
class
FGroupTaskStarPUAlgorithm
:
public
FAbstractAlgorithm
{
protected:
typedef
FGroupTaskStarPUAlgorithm
<
OctreeClass
,
CellContainerClass
,
KernelClass
,
ParticleGroupClass
,
StarPUCpuWrapperClass
#ifdef SCALFMM_ENABLE_CUDA_KERNEL
...
...
@@ -134,6 +134,8 @@ public:
FAssertLF
(
tree
,
"tree cannot be null"
);
FAssertLF
(
inKernels
,
"kernels cannot be null"
);
FAbstractAlgorithm
::
setNbLevelsInTree
(
tree
->
getHeight
());
struct
starpu_conf
conf
;
FAssertLF
(
starpu_conf_init
(
&
conf
)
==
0
);
FStarPUFmmPriorities
::
Controller
().
init
(
&
conf
,
tree
->
getHeight
(),
inKernels
);
...
...
@@ -235,7 +237,11 @@ public:
starpu_shutdown
();
}
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
protected:
/**
* Runs the complete algorithm.
*/
void
executeCore
(
const
unsigned
operationsToProceed
)
override
{
FLOG
(
FLog
::
Controller
<<
"
\t
Start FGroupTaskStarPUAlgorithm
\n
"
);
const
bool
directOnly
=
(
tree
->
getHeight
()
<=
2
);
...
...
@@ -263,7 +269,7 @@ public:
starpu_pause
();
}
protected:
void
initCodelet
(){
memset
(
&
p2m_cl
,
0
,
sizeof
(
p2m_cl
));
#ifdef STARPU_USE_CPU
...
...
@@ -738,7 +744,7 @@ protected:
void
upwardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
2
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FMath
::
Min
(
tree
->
getHeight
()
-
2
,
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
)
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
int
idxSubGroup
=
0
;
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
...
...
@@ -799,7 +805,7 @@ protected:
void
transferPass
(){
FLOG
(
FTic
timer
;
);
FLOG
(
FTic
timerInBlock
;
FTic
timerOutBlock
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
FLOG
(
timerInBlock
.
tic
()
);
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
starpu_insert_task
(
&
m2l_cl_in
,
...
...
@@ -848,7 +854,7 @@ protected:
void
downardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
2
;
idxLevel
<=
tree
->
getHeight
()
-
2
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
int
idxSubGroup
=
0
;
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
...
...
Src/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp
View file @
48d763c1
...
...
@@ -54,7 +54,7 @@ template <class OctreeClass, class CellContainerClass, class KernelClass, class
,
class
StarPUOpenClWrapperClass
=
FStarPUOpenClWrapper
<
KernelClass
,
FOpenCLDeviceWrapper
<
KernelClass
>>
#endif
>
class
FGroupTaskStarPUMpiAlgorithm
{
class
FGroupTaskStarPUMpiAlgorithm
:
public
FAbstractAlgorithm
{
protected:
typedef
FGroupTaskStarPUMpiAlgorithm
<
OctreeClass
,
CellContainerClass
,
KernelClass
,
ParticleGroupClass
,
StarPUCpuWrapperClass
#ifdef SCALFMM_ENABLE_CUDA_KERNEL
...
...
@@ -151,6 +151,8 @@ public:
FAssertLF
(
tree
,
"tree cannot be null"
);
FAssertLF
(
inKernels
,
"kernels cannot be null"
);
FAbstractAlgorithm
::
setNbLevelsInTree
(
tree
->
getHeight
());
struct
starpu_conf
conf
;
FAssertLF
(
starpu_conf_init
(
&
conf
)
==
0
);
FStarPUFmmPriorities
::
Controller
().
init
(
&
conf
,
tree
->
getHeight
(),
inKernels
);
...
...
@@ -254,7 +256,11 @@ public:
starpu_shutdown
();
}
void
execute
(
const
unsigned
operationsToProceed
=
FFmmNearAndFarFields
){
protected:
/**
* Runs the complete algorithm.
*/
void
executeCore
(
const
unsigned
operationsToProceed
)
override
{
FLOG
(
FLog
::
Controller
<<
"
\t
Start FGroupTaskStarPUMpiAlgorithm
\n
"
);
const
bool
directOnly
=
(
tree
->
getHeight
()
<=
2
);
...
...
@@ -291,7 +297,7 @@ public:
starpu_pause
();
}
protected:
void
initCodelet
(){
memset
(
&
p2m_cl
,
0
,
sizeof
(
p2m_cl
));
#ifdef STARPU_USE_CPU
...
...
@@ -921,7 +927,7 @@ protected:
FAssertLF
(
tree
->
getHeight
()
==
int
(
remoteCellGroups
.
size
()));
const
bool
directOnly
=
(
tree
->
getHeight
()
<=
2
);
if
(
!
directOnly
){
for
(
int
idxLevel
=
0
;
idxLevel
<
tree
->
getHeight
()
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
;
++
idxLevel
){
for
(
int
idxHandle
=
0
;
idxHandle
<
int
(
remoteCellGroups
[
idxLevel
].
size
())
;
++
idxHandle
){
if
(
remoteCellGroups
[
idxLevel
][
idxHandle
].
ptrSymb
){
FAssertLF
(
remoteCellGroups
[
idxLevel
][
idxHandle
].
ptrUp
);
...
...
@@ -1328,7 +1334,7 @@ protected:
void
upwardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
2
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FMath
::
Min
(
tree
->
getHeight
()
-
2
,
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
)
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
int
idxSubGroup
=
0
;
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
...
...
@@ -1507,7 +1513,7 @@ protected:
void
transferPassMpi
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
for
(
int
idxInteraction
=
0
;
idxInteraction
<
int
(
externalInteractionsAllLevelMpi
[
idxLevel
][
idxGroup
].
size
())
;
++
idxInteraction
){
const
int
interactionid
=
externalInteractionsAllLevelMpi
[
idxLevel
][
idxGroup
][
idxInteraction
].
otherBlockId
;
...
...
@@ -1537,7 +1543,7 @@ protected:
void
transferPass
(){
FLOG
(
FTic
timer
;
);
FLOG
(
FTic
timerInBlock
;
FTic
timerOutBlock
;
);
for
(
int
idxLevel
=
tree
->
getHeight
()
-
1
;
idxLevel
>=
2
;
--
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
idxLevel
>=
FAbstractAlgorithm
::
upperWorkingLevel
;
--
idxLevel
){
FLOG
(
timerInBlock
.
tic
()
);
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
starpu_insert_task
(
&
m2l_cl_in
,
...
...
@@ -1586,7 +1592,7 @@ protected:
void
downardPass
(){
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
2
;
idxLevel
<=
tree
->
getHeight
()
-
2
;
++
idxLevel
){
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
/////////////////////////////////////////////////////////////
// Exchange for MPI
/////////////////////////////////////////////////////////////
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment