Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
7682976d
Commit
7682976d
authored
Mar 10, 2017
by
Berenger Bramas
Browse files
remove BenchEfficiency
parent
c370ea26
Changes
9
Hide whitespace changes
Inline
Side-by-side
Addons/BenchEfficiency/CMakeLists.txt
deleted
100644 → 0
View file @
c370ea26
Addons/BenchEfficiency/execAllHomogeneous.sh
deleted
100644 → 0
View file @
c370ea26
#!/bin/bash
echo
"Perform the computation for :"
echo
"
$SCALFMM_NB
particles"
echo
"
$SCALFMM_H
tree height"
echo
"Up to
$SCALFMM_MAX_NB_CPU
CPUs"
echo
""
echo
"Using granularities:"
echo
"
$SCALFMM_BS_CPU_SEQ
and
$SCALFMM_BS_CPU_PAR
"
# only in seq with the seq bs
cpu
=
1
STARPU_NCPUS
=
$cpu
STARPU_NCUDA
=
0
logoutput
=
`
./Tests/Release/testBlockedUniformBench
-nb
$SCALFMM_NB
-h
$SCALFMM_H
-bs
$SCALFMM_BS_CPU_SEQ
`
if
[[
$VERBOSE
]]
;
then
echo
$logoutput
fi
$TUTORIAL_STARPU_DIR
/bin/starpu_fxt_tool
-i
"/tmp/prof_file_"
$USER
"_0"
rec_name
=
"
$SCALFMM_RES_DIR
/trace-nb_
$SCALFMM_NB
-h_
$SCALFMM_H
-bs_
$SCALFMM_BS_CPU_SEQ
-CPU_
$cpu
.rec"
mv
trace.rec
$rec_name
python
$TUTORIAL_STARPU_DIR
/bin/starpu_trace_state_stats.py
-t
$rec_name
>
$rec_name
.time
for
((
cpu
=
1
;
cpu<
=
$SCALFMM_MAX_NB_CPU
;
cpu++
))
;
do
echo
">> CPU =
$cpu
"
STARPU_NCPUS
=
$cpu
STARPU_NCUDA
=
0
logoutput
=
`
./Tests/Release/testBlockedUniformBench
-nb
$SCALFMM_NB
-h
$SCALFMM_H
-bs
$SCALFMM_BS_CPU_PAR
`
if
[[
$VERBOSE
]]
;
then
echo
$logoutput
fi
$TUTORIAL_STARPU_DIR
/bin/starpu_fxt_tool
-i
"/tmp/prof_file_"
$USER
"_0"
rec_name
=
"
$SCALFMM_RES_DIR
/trace-nb_
$SCALFMM_NB
-h_
$SCALFMM_H
-bs_
$SCALFMM_BS_CPU_PAR
-CPU_
$cpu
.rec"
mv
trace.rec
$rec_name
python
$TUTORIAL_STARPU_DIR
/bin/starpu_trace_state_stats.py
-t
$rec_name
>
$rec_name
.time
done
Addons/BenchEfficiency/mergetimefile.cpp
deleted
100644 → 0
View file @
c370ea26
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cassert>
#include <sstream>
#include <cstring>
template
<
class
VariableType
>
inline
VariableType
StrToOther
(
const
std
::
string
&
str
,
const
VariableType
&
defaultValue
=
VariableType
(),
bool
*
hasWorked
=
nullptr
){
std
::
istringstream
iss
(
str
,
std
::
istringstream
::
in
);
VariableType
value
=
defaultValue
;
iss
>>
value
;
if
(
hasWorked
){
if
(
!
iss
.
eof
()){
char
c
;
iss
>>
c
;
(
*
hasWorked
)
=
(
c
==
'\n'
||
c
==
'\0'
);
}
else
{
(
*
hasWorked
)
=
true
;
}
}
if
(
/*iss.tellg()*/
iss
.
eof
()
)
return
value
;
return
defaultValue
;
}
std
::
string
ReduceName
(
const
std
::
string
name
){
const
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
mapping
=
{
{
"M2M-level"
,
"M2M"
}
,
{
"M2L-level"
,
"M2L"
}
,
{
"M2L-out-level"
,
"M2L-out"
}
,
{
"L2L-level"
,
"L2L"
}
};
for
(
const
std
::
pair
<
std
::
string
,
std
::
string
>
mp
:
mapping
){
if
(
name
.
substr
(
0
,
mp
.
first
.
length
())
==
mp
.
first
){
return
mp
.
second
;
}
}
return
name
;
}
struct
LineData
{
std
::
string
name
;
int
nb
;
std
::
string
type
;
double
duration
;
LineData
(
const
char
line
[]){
std
::
vector
<
std
::
string
>
words
;
{
int
start
=
0
;
int
end
=
1
;
while
(
line
[
end
]
!=
'\0'
){
while
(
line
[
end
]
!=
'\0'
&&
line
[
end
]
!=
','
){
end
+=
1
;
}
if
(
line
[
end
]
!=
'\0'
){
words
.
push_back
(
std
::
string
(
&
line
[
start
],
end
-
start
));
end
+=
1
;
start
=
end
;
}
}
if
(
start
!=
end
){
words
.
push_back
(
std
::
string
(
&
line
[
start
],
end
-
start
));
}
}
if
(
words
.
size
()
!=
4
){
printf
(
"Error line is no composed of 4 words, has %lu for %s
\n
"
,
words
.
size
(),
line
);
exit
(
111
);
}
name
=
ReduceName
(
words
[
0
].
substr
(
1
,
words
[
0
].
size
()
-
2
));
bool
hasWorked
=
false
;
nb
=
StrToOther
<
int
>
(
words
[
1
],
-
1
,
&
hasWorked
);
if
(
hasWorked
==
false
){
printf
(
"Error cannot get nb val
\n
"
);
exit
(
112
);
}
type
=
words
[
2
].
substr
(
1
,
words
[
2
].
size
()
-
2
);
duration
=
StrToOther
<
double
>
(
words
[
3
],
0
,
&
hasWorked
);
if
(
hasWorked
==
false
){
printf
(
"Error cannot get duration val
\n
"
);
exit
(
112
);
}
}
};
struct
TimeData
{
TimeData
()
:
tt
(
0
),
tr
(
0
),
ti
(
0
){
}
double
tt
;
// time in task
double
tr
;
// time in runtime
double
ti
;
// time idle
};
/*
"Name","Count","Type","Duration"
"Initializing",24,"Runtime",1.259594
"Overhead",6304,"Runtime",150.667381
"Idle",1635,"Other",2.964436
"Scheduling",3285,"Runtime",50.173307
"Sleeping",330,"Other",10978.895357
"FetchingInput",1611,"Runtime",2.834788
"execute_on_all_wrapper",48,"Task",60.98058
"PushingOutput",1611,"Runtime",49.857017
"P2P-out",403,"Task",3840.070231
"Callback",1447,"Runtime",0.459004
"P2M",49,"Task",7759.555381
"M2M-level-5",49,"Task",916.867961
"M2L-level-5",7,"Task",3866.40312
"M2M-level-4",7,"Task",90.183757
"M2L-out-level-5",32,"Task",809.783766
"P2P",49,"Task",28378.015095
"L2L-level-5",49,"Task",749.115965
"M2L-level-6",49,"Task",33069.582498
"M2L-out-level-6",806,"Task",10014.65321
"L2P",49,"Task",10532.198512
"Deinitializing",24,"Runtime",0.600177
"M2L-level-3",1,"Task",45.115451
"M2L-level-2",1,"Task",2.638928
"L2L-level-2",1,"Task",1.343462
"L2L-level-4",7,"Task",87.756298
"L2L-level-3",1,"Task",10.658414
"M2M-level-3",1,"Task",11.480571
"M2M-level-2",1,"Task",1.41104
"M2L-level-4",1,"Task",511.345345
*/
int
main
(
int
argc
,
char
**
argv
){
if
(
argc
!=
4
){
printf
(
"Error usage is:
\n
"
"%s seq_file parallel_file%%d nb_threads
\n
"
,
argv
[
0
]);
return
200
;
}
printf
(
"seq file is %s
\n
"
,
argv
[
1
]);
printf
(
"parallel file are %s
\n
"
,
argv
[
2
]);
const
int
nbThreads
=
StrToOther
<
int
>
(
argv
[
3
],
-
1
);
if
(
nbThreads
==
1
){
printf
(
"Error cannot convert nb threads
\n
"
);
return
201
;
}
printf
(
"up to %d threads
\n
"
,
nbThreads
);
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
double
>>
timeTasks
;
std
::
unordered_set
<
std
::
string
>
allTaskNames
;
std
::
vector
<
TimeData
>
times
;
for
(
int
idxFile
=
0
;
idxFile
<=
nbThreads
;
++
idxFile
){
char
filename
[
1024
];
if
(
idxFile
==
0
){
strncpy
(
filename
,
argv
[
1
],
1024
);
}
else
{
sprintf
(
filename
,
argv
[
2
],
idxFile
);
}
timeTasks
.
emplace_back
();
times
.
emplace_back
();
printf
(
"Open file : %s
\n
"
,
filename
);
FILE
*
timeFile
=
fopen
(
filename
,
"r"
);
if
(
timeFile
==
NULL
){
printf
(
"Cannot open file %s
\n
"
,
filename
);
return
99
;
}
size_t
sizeLine
=
1024
;
char
*
line
=
(
char
*
)
malloc
(
sizeLine
);
{
// Read header
if
((
sizeLine
=
getline
((
char
**
)
&
line
,
&
sizeLine
,
timeFile
))
==
-
1
){
printf
(
"Cannot read header
\n
"
);
return
1
;
}
// Should be: "Name","Count","Type","Duration"
if
(
strcmp
(
"
\"
Name
\"
,
\"
Count
\"
,
\"
Type
\"
,
\"
Duration
\"\n
"
,
line
)
!=
0
){
printf
(
"Header is incorrect
\n
"
);
return
2
;
}
}
while
((
sizeLine
=
getline
((
char
**
)
&
line
,
&
sizeLine
,
timeFile
))
!=
-
1
){
if
(
strncmp
(
line
,
"WARNING"
,
7
)
!=
0
){
LineData
dt
(
line
);
// Task, Runtime, Other
if
(
dt
.
type
==
"Task"
){
if
(
dt
.
name
!=
"execute_on_all_wrapper"
){
timeTasks
[
idxFile
][
dt
.
name
]
+=
dt
.
duration
;
allTaskNames
.
insert
(
dt
.
name
);
times
[
idxFile
].
tt
+=
dt
.
duration
;
}
}
else
if
(
dt
.
type
==
"Runtime"
){
if
(
dt
.
name
==
"Scheduling"
||
dt
.
name
==
"FetchingInput"
||
dt
.
name
==
"PushingOutput"
){
times
[
idxFile
].
tr
+=
dt
.
duration
;
}
}
else
if
(
dt
.
type
==
"Other"
){
if
(
dt
.
name
==
"Idle"
){
times
[
idxFile
].
ti
+=
dt
.
duration
;
}
}
else
{
printf
(
"Arg do not know type %s
\n
"
,
dt
.
type
.
c_str
());
//return 3;
}
}
}
fclose
(
timeFile
);
}
// Global efficiencies
{
// Manually set seq idel and runtime
times
[
0
].
ti
=
0
;
times
[
0
].
tr
=
0
;
times
[
1
].
ti
=
0
;
times
[
1
].
tr
=
0
;
printf
(
"Create global-eff.data
\n
"
);
FILE
*
resFile
=
fopen
(
"global-eff.data"
,
"w"
);
assert
(
resFile
);
fprintf
(
resFile
,
"0
\t
granularity-eff
\t
tasks-eff
\t
runtime-eff
\t
pipeline-eff
\n
"
);
for
(
int
idx
=
1
;
idx
<=
nbThreads
;
++
idx
){
fprintf
(
resFile
,
"%d
\t
%e
\t
%e
\t
%e
\t
%e
\n
"
,
idx
,
times
[
0
].
tt
/
times
[
idx
].
tt
,
times
[
1
].
tt
/
times
[
idx
].
tt
,
times
[
idx
].
tt
/
(
times
[
idx
].
tt
+
times
[
idx
].
tr
),
(
times
[
idx
].
tt
+
times
[
idx
].
tr
)
/
(
times
[
idx
].
tt
+
times
[
idx
].
tr
+
times
[
idx
].
ti
));
}
fclose
(
resFile
);
}
// Global efficiencies
{
printf
(
"Create task-eff.data
\n
"
);
FILE
*
resFile
=
fopen
(
"task-eff.data"
,
"w"
);
assert
(
resFile
);
fprintf
(
resFile
,
"0 "
);
for
(
const
std
::
string
tsk
:
allTaskNames
){
fprintf
(
resFile
,
"
\t
%s "
,
tsk
.
c_str
());
}
fprintf
(
resFile
,
"
\n
"
);
for
(
int
idx
=
1
;
idx
<=
nbThreads
;
++
idx
){
fprintf
(
resFile
,
"%d"
,
idx
);
for
(
const
std
::
string
tsk
:
allTaskNames
){
fprintf
(
resFile
,
"
\t
%e "
,
timeTasks
[
1
][
tsk
]
/
timeTasks
[
idx
][
tsk
]);
}
fprintf
(
resFile
,
"
\n
"
);
}
fclose
(
resFile
);
}
{
printf
(
"Create task-gr-eff.data
\n
"
);
FILE
*
resFile
=
fopen
(
"task-gr-eff.data"
,
"w"
);
assert
(
resFile
);
fprintf
(
resFile
,
"0 "
);
for
(
const
std
::
string
tsk
:
allTaskNames
){
fprintf
(
resFile
,
"
\t
%s "
,
tsk
.
c_str
());
}
fprintf
(
resFile
,
"
\n
"
);
for
(
int
idx
=
1
;
idx
<=
nbThreads
;
++
idx
){
fprintf
(
resFile
,
"%d"
,
idx
);
for
(
const
std
::
string
tsk
:
allTaskNames
){
fprintf
(
resFile
,
"
\t
%e "
,
timeTasks
[
0
][
tsk
]
/
timeTasks
[
idx
][
tsk
]);
}
fprintf
(
resFile
,
"
\n
"
);
}
fclose
(
resFile
);
}
return
0
;
}
Addons/BenchEfficiency/paintmodel.fmm.colors
deleted
100644 → 0
View file @
c370ea26
#expression evaluation;replacement (if not empty);red;green;blue
P2P;;1.0;1.0;1.0
P2P-out;;0.7;0.7;0.7
(M2L-level-)[0-9]*;;0.2;0.2;0.6
(M2L-out-level-)[0-9]*;;0.1;0.1;0.6
(L2L-level-)[0-9]*;;0.2;0.6;0.2
(M2M-level-)[0-9]*;;0.1;0.6;0.6
P2M;;0.2;0.2;0.2
L2P;;0.6;0.8;0.2
Addons/BenchEfficiency/pajecolor
deleted
100755 → 0
View file @
c370ea26
File deleted
Addons/BenchEfficiency/scalfmmExtractKey.sh
deleted
100644 → 0
View file @
c370ea26
#!/bin/bash
if
[[
$#
-ne
1
]]
;
then
echo
"You must pass a key as parameter"
return
fi
input
=
$(
cat
)
res
=
`
echo
"
$input
"
|
grep
"
$1
"
|
cut
-d
'='
-f2
|
cut
-d
' '
-f2
`
echo
$res
Addons/BenchEfficiency/scalfmmFindBs.gplot
deleted
100644 → 0
View file @
c370ea26
#!/usr/bin/gnuplot
reset
set terminal png
set output filename . '.png'
set xlabel "bs"
set ylabel "time (s)"
set title "Bs"
set grid
set style data linespoints
plot "<sort -g -k1 benchBs.data" using 1:2 title "Example"
Addons/BenchEfficiency/scalfmmFindBs.sh
deleted
100644 → 0
View file @
c370ea26
#!/bin/bash
function
GetExecTime
()
{
>
&2
echo
"[LOG] Exec
$1
$2
"
local
res_output
=
`
$1
"
$2
"
`
>
&2
echo
"[LOG] Try to find
$3
"
local
time_result
=
`
echo
"
$res_output
"
|
grep
"
$3
"
|
cut
-d
'='
-f2
|
cut
-d
's'
-f1
`
if
[[
$VERBOSE
]]
;
then
>
&2
echo
"[LOG] output :
$res_output
"
fi
>
&2
echo
"[LOG] Done in
$time_result
"
echo
$time_result
}
function
isLower
()
{
awk
-v
n1
=
$1
-v
n2
=
$2
'BEGIN{ if (n1<n2) exit 0; exit 1}'
}
function
getMin
(){
if
isLower
$1
$2
;
then
echo
$1
else
echo
$2
fi
}
if
[[
"$#"
-ne
"3"
]]
;
then
echo
"Error you must provide 3 parameters:"
echo
"
$0
test-commnand-line starting-bs ending-bs"
return
fi
echo
"You ask to find the best bs for:"
echo
"Command:
$1
"
echo
"From
$2
to
$3
"
echo
"STARPU_NCPUS =
$STARPU_NCPUS
"
echo
"STARPU_NCUDA =
$STARPU_NCUDA
"
outputfile
=
./benchBs.data
echo
"# BS TIME"
>
$outputfile
left_bs
=
"
$2
"
left_exec_time
=
`
GetExecTime
"
$1
"
"
$left_bs
"
"@EXEC TIME"
`
echo
"
$left_bs
$left_exec_time
"
>>
$outputfile
best_bs
=
$left_bs
best_exec_time
=
"
$left_exec_time
"
right_bs
=
"
$3
"
right_exec_time
=
`
GetExecTime
"
$1
"
"
$right_bs
"
"@EXEC TIME"
`
echo
"
$right_bs
$right_exec_time
"
>>
$outputfile
if
isLower
$right_exec_time
$best_exec_time
;
then
best_bs
=
$right_bs
best_exec_time
=
"
$right_exec_time
"
fi
for
((
depth
=
0
;
depth<10
;
depth++
))
do
if
[[
$left_bs
-ge
$right_bs
]]
;
then
break
;
fi
>
&2
echo
"[LOG] Depth
$depth
..."
sub_left_bs
=
$((
(
$right_bs
-
$left_bs
)/
3
+
$left_bs
))
sub_left_exec_time
=
`
GetExecTime
"
$1
"
"
$sub_left_bs
"
"@EXEC TIME"
`
echo
"
$sub_left_bs
$sub_left_exec_time
"
>>
$outputfile
if
isLower
$sub_left_exec_time
$best_exec_time
;
then
best_bs
=
$sub_left_bs
best_exec_time
=
"
$sub_left_exec_time
"
fi
sub_right_bs
=
$((
2
*(
$right_bs
-
$left_bs
)/
3
+
$left_bs
))
sub_right_exec_time
=
`
GetExecTime
"
$1
"
"
$sub_right_bs
"
"@EXEC TIME"
`
echo
"
$sub_right_bs
$sub_right_exec_time
"
>>
$outputfile
if
isLower
$sub_right_exec_time
$best_exec_time
;
then
best_bs
=
$sub_right_bs
best_exec_time
=
"
$sub_right_exec_time
"
fi
min_from_left
=
`
getMin
$left_exec_time
$sub_left_exec_time
`
min_from_right
=
`
getMin
$right_exec_time
$sub_right_exec_time
`
if
isLower
$min_from_left
$min_from_right
;
then
right_bs
=
$sub_right_bs
right_exec_time
=
"
$sub_right_exec_time
"
else
left_bs
=
$sub_left_bs
left_exec_time
=
"
$sub_left_exec_time
"
fi
done
echo
"@BEST BS =
$best_bs
(in =
$best_exec_time
s)"
Addons/BenchEfficiency/scalfmmPlotAll.gplot
deleted
100644 → 0
View file @
c370ea26
#!/usr/bin/gnuplot
reset
set terminal png
set output filename . '.png'
set xlabel "Nb Threads"
set ylabel "Efficiency"
set grid
set style data linespoints
N = system("awk 'NR==1{print NF}' " . filename . ".data")
set key outside;
set key right top;
set key autotitle columnhead
do for [col=2:N:1] {
set style line col lw 3
}
plot for [col=2:N:1] filename . '.data' using 1:col with lp
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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