Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
solverstack
ScalFMM
Commits
48b4c296
Commit
48b4c296
authored
Mar 14, 2017
by
Berenger Bramas
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/simgrid'
parents
64603413
7863df56
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1017 additions
and
215 deletions
+1017
-215
CMakeLists.txt
CMakeLists.txt
+7
-2
Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp
Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp
+490
-140
Src/GroupTree/Core/starpu_codelet_parameters.h
Src/GroupTree/Core/starpu_codelet_parameters.h
+197
-0
Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp
Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp
+32
-0
Src/GroupTree/StarPUUtils/FStarPUHeteoprio.hpp
Src/GroupTree/StarPUUtils/FStarPUHeteoprio.hpp
+1
-1
Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp
Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp
+0
-67
Src/ScalFmmConfig.h.cmake
Src/ScalFmmConfig.h.cmake
+1
-1
Tests/GroupTree/testBlockedUniform.cpp
Tests/GroupTree/testBlockedUniform.cpp
+289
-4
No files found.
CMakeLists.txt
View file @
48b4c296
...
...
@@ -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
(
S
CALFMM
_SIMGRID_
TASKNAMEPARAM
S
"Set to ON to
have verbose information in the task name
"
OFF
)
# STARPU options
option
(
S
TARPU
_SIMGRID_
MLR_MODEL
S
"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
}
"
)
...
...
Src/GroupTree/Core/FGroupTaskStarpuAlgorithm.hpp
View file @
48b4c296
This diff is collapsed.
Click to expand it.
Src/GroupTree/Core/starpu_codelet_parameters.h
0 → 100644
View file @
48b4c296
#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__ */
Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp
View file @
48b4c296
...
...
@@ -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
);
}
...
...
Src/GroupTree/StarPUUtils/FStarPUHeteoprio.hpp
View file @
48b4c296
...
...
@@ -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
...
...
Src/GroupTree/StarPUUtils/FStarPUTaskNameParams.hpp
deleted
100644 → 0
View file @
64603413
#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
Src/ScalFmmConfig.h.cmake
View file @
48b4c296
...
...
@@ -167,6 +167,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_SIMGRID_NODATA
#cmakedefine S
CALFMM
_SIMGRID_
TASKNAMEPARAM
S
#cmakedefine S
TARPU
_SIMGRID_
MLR_MODEL
S
#endif // CONFIG_H
Tests/GroupTree/testBlockedUniform.cpp
View file @
48b4c296
...
...
@@ -45,10 +45,282 @@
#define RANDOM_PARTICLES
template
<
class
FReal
>
class
FSphericalRandomLoader
:
public
FAbstractLoader
<
FReal
>
{
protected:
const
int
nbParticles
;
//< the number of particles
const
FReal
boxWidth
;
//< the box width
const
FPoint
<
FReal
>
centerOfBox
;
//< The center of box
const
bool
nu
;
const
bool
snu
;
const
bool
su
;
const
bool
elu
;
const
bool
ssnu
;
const
bool
elsu
;
FReal
rotationMatrix
[
3
][
3
];
void
initRotationMatrix
(){
const
FReal
alpha
=
FMath
::
FPi
<
FReal
>
()
/
8
;
const
FReal
omega
=
FMath
::
FPi
<
FReal
>
()
/
4
;
FReal
yrotation
[
3
][
3
];
yrotation
[
0
][
0
]
=
FMath
::
Cos
(
alpha
);
yrotation
[
0
][
1
]
=
0.0
;
yrotation
[
0
][
2
]
=
FMath
::
Sin
(
alpha
);
yrotation
[
1
][
0
]
=
0.0
;
yrotation
[
1
][
1
]
=
1.0
;
yrotation
[
1
][
2
]
=
0.0
;
yrotation
[
2
][
0
]
=
-
FMath
::
Sin
(
alpha
);
yrotation
[
2
][
1
]
=
0.0
;
yrotation
[
2
][
2
]
=
FMath
::
Cos
(
alpha
);
FReal
zrotation
[
3
][
3
];
zrotation
[
0
][
0
]
=
FMath
::
Cos
(
omega
);
zrotation
[
0
][
1
]
=
-
FMath
::
Sin
(
omega
);
zrotation
[
0
][
2
]
=
0.0
;
zrotation
[
1
][
0
]
=
FMath
::
Sin
(
omega
);
zrotation
[
1
][
1
]
=
FMath
::
Cos
(
omega
);
zrotation
[
1
][
2
]
=
0.0
;
zrotation
[
2
][
0
]
=
0.0
;
zrotation
[
2
][
1
]
=
0.0
;
zrotation
[
2
][
2
]
=
1.0
;
for
(
int
i
=
0
;
i
<
3
;
++
i
){
for
(
int
j
=
0
;
j
<
3
;
++
j
){
FReal
sum
=
0.0
;
for
(
int
k
=
0
;
k
<
3
;
++
k
){
sum
+=
zrotation
[
i
][
k
]
*
yrotation
[
k
][
j
];
}
rotationMatrix
[
i
][
j
]
=
sum
;
}
}
}
public:
/**
* The constructor need the simulation data
*/
FSphericalRandomLoader
(
const
int
inNbParticles
,
const
bool
inNu
=
false
,
const
bool
inSnu
=
false
,
const
bool
inSu
=
false
,
const
bool
inElu
=
false
,
const
bool
inSsnu
=
false
,
const
bool
inElsu
=
false
)
:
nbParticles
(
inNbParticles
),
boxWidth
(
1.0
),
centerOfBox
(
0
,
0
,
0
),
nu
(
inNu
),
snu
(
inSnu
),
su
(
inSu
),
elu
(
inElu
),
ssnu
(
inSsnu
),
elsu
(
inElsu
)
{
srand48
(
static_cast
<
unsigned
int
>
(
0
));
if
(
!
nu
&&
!
snu
&&
!
su
&&
!
elu
&&
!
ssnu
&&
!
elsu
){
std
::
cout
<<
"UNIFORM"
<<
std
::
endl
;
}
else
if
(
snu
){
std
::
cout
<<
"slightly NON UNIFORM"
<<
std
::
endl
;
}
else
if
(
su
){
std
::
cout
<<
"SPHERICAL UNIFORM"
<<
std
::
endl
;
}
else
if
(
elu
){
std
::
cout
<<
"ELLIPSE UNIFORM"
<<
std
::
endl
;
}
else
if
(
elsu
){
std
::
cout
<<
"ELLIPSE NON UNIFORM"
<<
std
::
endl
;
initRotationMatrix
();
}
else
if
(
ssnu
){
std
::
cout
<<
"spherical Slightly non UNIFORM"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"NON UNIFORM"
<<
std
::
endl
;
}
}
/**
* Default destructor
*/
virtual
~
FSphericalRandomLoader
(){
}
/**
* @return true
*/
bool
isOpen
()
const
{
return
true
;
}
/**
* To get the number of particles from this loader
* @param the number of particles the loader can fill
*/
FSize
getNumberOfParticles
()
const
{
return
FSize
(
this
->
nbParticles
);
}
/**
* The center of the box
* @return box center
*/
FPoint
<
FReal
>
getCenterOfBox
()
const
{
return
this
->
centerOfBox
;
}
/**
* The box width
* @return box width
*/
FReal
getBoxWidth
()
const
{
return
this
->
boxWidth
;
}
/**
* Fill a particle
* @warning to work with the loader, particles has to expose a setPosition method
* @param the particle to fill
*/
void
fillParticle
(
FPoint
<
FReal
>*
partPtr
){
FPoint
<
FReal
>&
inParticle
=
*
partPtr
;
if
(
!
nu
&&
!
snu
&&
!
su
&&
!
elu
&&
!
ssnu
&&
!
elsu
){
inParticle
.
setPosition
(
(
getRandom
()
*
boxWidth
)
+
centerOfBox
.
getX
()
-
boxWidth
/
2
,
(
getRandom
()
*
boxWidth
)
+
centerOfBox
.
getY
()
-
boxWidth
/
2
,
(
getRandom
()
*
boxWidth
)
+
centerOfBox
.
getZ
()
-
boxWidth
/
2
);
}
else
if
(
snu
){
const
FReal
XCenter
=
centerOfBox
.
getX
();
const
FReal
YCenter
=
centerOfBox
.
getY
();
const
FReal
ZCenter
=
centerOfBox
.
getZ
();
const
FReal
rayon
=
FReal
(
0.4
);
const
FReal
thresh
=
FReal
(
0.15
);
const
FReal
threshDiv2
=
thresh
/
2
;
// Generate particles
const
FReal
theta
=
getRandom
()
*
FMath
::
FPi
<
FReal
>
();
const
FReal
omega
=
getRandom
()
*
FMath
::
FPi
<
FReal
>
()
*
FReal
(
2
);
const
FReal
px
=
rayon
*
FMath
::
Cos
(
omega
)
*
FMath
::
Sin
(
theta
)
+
XCenter
+
thresh
*
getRandom
()
-
threshDiv2
;
const
FReal
py
=
rayon
*
FMath
::
Sin
(
omega
)
*
FMath
::
Sin
(
theta
)
+
YCenter
+
thresh
*
getRandom
()
-
threshDiv2
;
const
FReal
pz
=
rayon
*
FMath
::
Cos
(
theta
)
+
ZCenter
+
thresh
*
getRandom
()
-
threshDiv2
;
inParticle
.
setPosition
(
px
,
py
,
pz
);
}
else
if
(
su
){
//http://www.cs.cmu.edu/~mws/rpos.html
const
FReal
r
=
0.4
;
const
FReal
pz
=
getRandom
()
*
2.0
*
r
-
r
;
const
FReal
omega
=
getRandom
()
*
FMath
::
FPi
<
FReal
>
()
*
FReal
(
2
);
const
FReal
theta
=
FMath
::
ASin
(
pz
/
r
);
const
FReal
px
=
r
*
cos
(
theta
)
*
cos
(
omega
);
const
FReal
py
=
r
*
cos
(
theta
)
*
sin
(
omega
);
inParticle
.
setPosition
(
px
,
py
,
pz
);
}
else
if
(
elu
){
const
FReal
a
=
0.4
;
const
FReal
b
=
0.15
;
const
FReal
maxPerimeter
=
2.0
*
FMath
::
FPi
<
FReal
>
()
*
a
;
FReal
px
=
0
;
// rayon du cercle pour ce x
FReal
subr
=
0
;
do
{
px
=
(
getRandom
()
*
a
*
2
)
-
a
;
subr
=
FMath
::
Sqrt
(
(
1.0
-
((
px
*
px
)
/
(
a
*
a
)))
*
(
b
*
b
)
);
}
while
(
(
getRandom
()
*
maxPerimeter
)
>
subr
);
// on genere un angle
const
FReal
omega
=
getRandom
()
*
FMath
::
FPi
<
FReal
>
()
*
FReal
(
2
);
// on recupere py et pz sur le cercle
const
FReal
py
=
FMath
::
Cos
(
omega
)
*
subr
;
const
FReal
pz
=
FMath
::
Sin
(
omega
)
*
subr
;