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
tansiv
TANSIV
Commits
c5f1a98b
Verified
Commit
c5f1a98b
authored
May 27, 2020
by
SIMONIN Matthieu
Browse files
add bench doing some work
parent
4329a93d
Pipeline
#147641
failed with stages
in 3 minutes and 10 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
c5f1a98b
...
...
@@ -10,8 +10,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/tools/cmake/"
)
# order of linked library is important !
# https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc
set
(
FAKEVM_LIBS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/fake-vm/target/debug
/libfake_vm.a dl rt pthread cppunit
)
set
(
FAKEVM_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/fake-vm/capi/src/
)
set
(
FAKEVM_LIBS
/opt/fake-vm/lib
/libfake_vm.a dl rt pthread cppunit
)
set
(
FAKEVM_INCLUDE_DIR
/opt/fake-vm/include
)
set
(
VSG_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/vsg/
)
# Search for SimGrid
...
...
@@ -20,14 +20,15 @@ find_package(SimGrid REQUIRED)
include_directories
(
"
${
SimGrid_INCLUDE_DIR
}
"
"
${
FAKEVM_INCLUDE_DIR
}
"
"
${
VSG_INCLUDE_DIR
}
"
SYSTEM
)
# fake-vm client lib (rust implementation)
add_custom_target
(
fake-vm ALL COMMAND make WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/fake-vm
)
# installed in /opt/fake-vm
# compiled in RELEASE mode (I've got the power !)
add_custom_target
(
fake-vm ALL COMMAND make PREFIX=/opt/fake-vm RELEASE=0 install WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/fake-vm
)
# vsg lib (actor side)
add_library
(
vsg STATIC src/vsg/vsg.c src/vsg/log.c
)
target_compile_options
(
vsg PUBLIC -DLOG_USE_COLOR
)
target_link_libraries
(
vsg PUBLIC m
)
# Tansiv (coordinator of the simulation)
add_executable
(
tansiv src/simgrid/VmsInterface.cpp src/simgrid/VmsCoordinator.cpp
)
target_link_libraries
(
tansiv
${
SimGrid_LIBRARY
}
${
FAKEVM_LIBS
}
vsg
)
...
...
examples/benchs/gettimeofday.cpp
View file @
c5f1a98b
#include <atomic>
#include <cstring>
#include <limits>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
...
...
@@ -12,6 +13,8 @@ extern "C" {
using
namespace
std
;
#define MAX_COUNT ((uint64_t)pow(10, 8))
// Addresses used in this program
#define ADDR_FMT "10.0.%d.1"
...
...
@@ -59,48 +62,47 @@ vsg_context* init_vsg(int argc, char* argv[])
#define LIMIT 5
int
bench_vsg_gettimeofday
(
int
argc
,
char
*
argv
[])
double
to_double
(
timeval
time
)
{
return
(
double
)
time
.
tv_sec
+
((
double
)
time
.
tv_usec
)
*
pow
(
10
,
-
6
);
}
double
bench_vsg_gettimeofday
(
int
argc
,
char
*
argv
[])
{
vsg_context
*
context
=
init_vsg
(
argc
,
argv
);
timeval
limit
=
{.
tv_sec
=
LIMIT
,
.
tv_usec
=
0
};
int
loop_count
;
timeval
start
;
vsg_gettimeofday
(
context
,
&
start
,
NULL
);
timeval
current
;
timeval
diff
;
for
(
loop_count
=
0
;
loop_count
<
std
::
numeric_limits
<
int
>::
max
();
loop_count
++
)
{
vsg_gettimeofday
(
context
,
&
current
,
NULL
);
timersub
(
&
current
,
&
start
,
&
diff
);
if
(
timercmp
(
&
diff
,
&
limit
,
>=
))
{
break
;
}
double
result
=
0.
;
vsg_gettimeofday
(
context
,
&
start
,
NULL
);
for
(
int
loop_count
=
1
;
loop_count
<
MAX_COUNT
;
loop_count
++
)
{
result
=
result
+
1
/
pow
(
loop_count
,
2
);
}
printf
(
"I'm done with bench_vsg_gettimeofday
\n
"
);
return
loop_count
;
vsg_gettimeofday
(
context
,
&
current
,
NULL
);
timersub
(
&
current
,
&
start
,
&
diff
);
// printf("vsg_gettimeofday] 6*result = %f\n", result);
return
to_double
(
diff
);
}
int
bench_gettimeofday
(
int
argc
,
char
*
argv
[])
double
bench_gettimeofday
(
int
argc
,
char
*
argv
[])
{
timeval
limit
=
{.
tv_sec
=
LIMIT
,
.
tv_usec
=
0
};
int
loop_count
;
timeval
start
;
gettimeofday
(
&
start
,
NULL
);
timeval
current
;
timeval
diff
;
for
(
loop_count
=
0
;
loop_count
<
std
::
numeric_limits
<
int
>::
max
();
loop_count
++
)
{
// TODO(msimonin): faire un truc genre une addition
// à nombre d'itérations fixé
// compilé en mode release (make RELEASE=0)
// make install avec prefix connu
gettimeofday
(
&
current
,
NULL
);
timersub
(
&
current
,
&
start
,
&
diff
);
if
(
timercmp
(
&
diff
,
&
limit
,
>=
))
{
break
;
}
double
result
=
0.
;
gettimeofday
(
&
start
,
NULL
);
for
(
int
loop_count
=
1
;
loop_count
<
MAX_COUNT
;
loop_count
++
)
{
result
=
result
+
1.
/
pow
(
loop_count
,
2
);
}
printf
(
"I'm done with bench_gettimeofday
\n
"
);
return
loop_count
;
gettimeofday
(
&
current
,
NULL
);
timersub
(
&
current
,
&
start
,
&
diff
);
// printf("gettimeofday] 6*result = %f\n", result);
return
to_double
(
diff
);
}
/*
...
...
@@ -109,13 +111,14 @@ int bench_gettimeofday(int argc, char* argv[])
*/
int
main
(
int
argc
,
char
*
argv
[])
{
int
count1
=
bench_gettimeofday
(
argc
,
argv
);
int
count2
=
bench_vsg_gettimeofday
(
argc
,
argv
);
double
rate1
=
(
double
)
count1
/
LIMIT
;
double
rate2
=
(
double
)
count2
/
LIMIT
;
double
time1
=
bench_gettimeofday
(
argc
,
argv
);
double
time2
=
bench_vsg_gettimeofday
(
argc
,
argv
);
printf
(
"%f, %f
\n
"
,
time1
,
time2
)
;
/*
printf("\n");
printf
(
"|%-20s|%16.
2
f
/
s|
\n
"
,
"gettimeofday"
,
rat
e1
);
printf
(
"|%-20s|%16.
2
f
/
s|
\n
"
,
"vsg_gettimeofday"
,
rat
e2
);
printf("|%-20s|%16.
3
f s|\n", "gettimeofday",
tim
e1);
printf("|%-20s|%16.
3
f s|\n", "vsg_gettimeofday",
tim
e2);
printf("\n");
*/
exit
(
0
);
}
examples/benchs/gettimeofday.png
0 → 100644
View file @
c5f1a98b
41.5 KB
examples/benchs/nova_cluster.xml
View file @
c5f1a98b
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform
version=
"4.1"
>
<zone
id=
"AS0"
routing=
"Full"
>
<cluster
id=
"nova"
prefix=
"nova-"
suffix=
".lyon.grid5000.fr"
radical=
"0-200"
speed=
"16120000000.0f,0.0f,0.0f"
core=
"16"
bw=
"10Gbps"
lat=
"1.0E-
4
s"
router_id=
"router1"
>
<cluster
id=
"nova"
prefix=
"nova-"
suffix=
".lyon.grid5000.fr"
radical=
"0-200"
speed=
"16120000000.0f,0.0f,0.0f"
core=
"16"
bw=
"10Gbps"
lat=
"1.0E-
3
s"
router_id=
"router1"
>
<prop
id=
"watt_per_state"
value=
"75.83:81.97:174.04, 123.86:123.86:123.86, 66:66:66"
/>
<prop
id=
"watt_off"
value=
"8.81"
/>
</cluster>
...
...
examples/benchs/readme.md
0 → 100644
View file @
c5f1a98b
small bench:
```
bash
for
i
in
{
1..20
}
;
do for
i
in
1 0.5 0.1 0.05 0.01
;
do
echo
"
$i
,
$(
./tansiv examples/benchs/nova_cluster.xml examples/benchs/deployment.xml
--force
$i
)
"
>>
gettimeofday.csv
;
done
;
done
```
```
python
import
pandas
as
pd
import
matplotlib.pyplot
as
plt
import
seaborn
as
sns
df
=
pd
.
read_csv
(
"./gettimeofday.csv"
)
df
.
columns
=
[
"latency"
,
"gettimeofday"
,
"vsg_gettimeofday"
]
# tidy it
ddf
=
pd
.
melt
(
df
,
id_vars
=
[
"latency"
],
value_vars
=
[
"gettimeofday"
,
"vsg_gettimeofday"
])
sns
.
swarmplot
(
data
=
ddf
,
x
=
"latency"
,
y
=
"value"
,
hue
=
"variable"
)
plt
.
show
()
```
[
gettimeofday
](
gettimeofday.png
)
\ No newline at end of file
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