Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gauthier Quesnel
irritator
Commits
80f4f73e
Commit
80f4f73e
authored
Aug 13, 2020
by
K-H-Ismail
Committed by
Gauthier Quesnel
Aug 14, 2020
Browse files
benchmark: add qss3 benchmark
parent
b2d61f26
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
lib/benchmark/benchmark_exactitude_qss1.cpp
View file @
80f4f73e
...
...
@@ -333,11 +333,11 @@ BENCHMARK_P_INSTANCE(Izhikevich, QSS1, (1000,1e-2,0.02,0.2,-50.0,2.0,10.0,0.0));
// Fast spiking (FS)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS1
,
(
1000
,
1e-2
,
0.1
,
0.2
,
-
65.0
,
2.0
,
10.0
,
0.0
));
// Thalamo-Cortical (TC)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS1, (1000,1e-2,0.02,0.25,-65.0,0.05,10.0,-87.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS1
,
(
1000
,
1e-2
,
0.02
,
0.25
,
-
65.0
,
0.05
,
10.0
,
-
87.0
));
// Rezonator (RZ)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS1, (1000,1e-2,0.1,0.26,-65.0,2.0,10.0,-63.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS1
,
(
1000
,
1e-2
,
0.1
,
0.26
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Low-threshold spiking (LTS)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS1, (1000,1e-2,0.02,0.25,-65.0,2.0,10.0,-63.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS1
,
(
1000
,
1e-2
,
0.02
,
0.25
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Problematic (P)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS1
,
(
1000
,
1e-2
,
0.2
,
2
,
-
56.0
,
-
16.0
,
-
99.0
,
0.0
));
...
...
lib/benchmark/benchmark_exactitude_qss2.cpp
View file @
80f4f73e
...
...
@@ -333,11 +333,11 @@ BENCHMARK_P_INSTANCE(Izhikevich, QSS2, (1000,1e-2,0.02,0.2,-50.0,2.0,10.0,0.0));
// Fast spiking (FS)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS2
,
(
1000
,
1e-2
,
0.1
,
0.2
,
-
65.0
,
2.0
,
10.0
,
0.0
));
// Thalamo-Cortical (TC)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS2, (1000,1e-2,0.02,0.25,-65.0,0.05,10.0,-87.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS2
,
(
1000
,
1e-2
,
0.02
,
0.25
,
-
65.0
,
0.05
,
10.0
,
-
87.0
));
// Rezonator (RZ)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS2, (1000,1e-2,0.1,0.26,-65.0,2.0,10.0,-63.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS2
,
(
1000
,
1e-2
,
0.1
,
0.26
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Low-threshold spiking (LTS)
//
BENCHMARK_P_INSTANCE(Izhikevich, QSS2, (1000,1e-2,0.02,0.25,-65.0,2.0,10.0,-63.0));
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS2
,
(
1000
,
1e-2
,
0.02
,
0.25
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Problematic (P)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS2
,
(
1000
,
1e-2
,
0.2
,
2
,
-
56.0
,
-
16.0
,
-
99.0
,
0.0
));
...
...
lib/benchmark/benchmark_exactitude_qss3.cpp
0 → 100644
View file @
80f4f73e
// Copyright (c) 2020 INRA Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <hayai.hpp>
#include <irritator/core.hpp>
#include <boost/ut.hpp>
#include <fmt/format.h>
#include <cstdio>
#include <fstream>
using
namespace
std
;
struct
file_output
{
file_output
(
const
char
*
file_path
)
noexcept
:
os
(
std
::
fopen
(
file_path
,
"w"
))
{}
~
file_output
()
noexcept
{
if
(
os
)
std
::
fclose
(
os
);
}
std
::
FILE
*
os
=
nullptr
;
};
void
file_output_initialize
(
const
irt
::
observer
&
obs
,
const
irt
::
time
/*t*/
)
noexcept
{
if
(
!
obs
.
user_data
)
return
;
auto
*
output
=
reinterpret_cast
<
file_output
*>
(
obs
.
user_data
);
fmt
::
print
(
output
->
os
,
"t,{}
\n
"
,
obs
.
name
.
c_str
());
}
void
file_output_observe
(
const
irt
::
observer
&
obs
,
const
irt
::
time
t
,
const
irt
::
message
&
msg
)
noexcept
{
if
(
!
obs
.
user_data
)
return
;
auto
*
output
=
reinterpret_cast
<
file_output
*>
(
obs
.
user_data
);
fmt
::
print
(
output
->
os
,
"{},{}
\n
"
,
t
,
msg
.
real
[
0
]);
}
struct
neuron
{
irt
::
dynamics_id
sum
;
irt
::
dynamics_id
integrator
;
irt
::
dynamics_id
constant
;
irt
::
dynamics_id
cross
;
irt
::
dynamics_id
constant_cross
;
};
struct
neuron
make_neuron
(
irt
::
simulation
*
sim
,
long
unsigned
int
i
,
double
quantum
)
noexcept
{
using
namespace
boost
::
ut
;
double
tau_lif
=
10
;
double
Vr_lif
=
0.0
;
double
Vt_lif
=
10.0
;
auto
&
sum_lif
=
sim
->
qss3_wsum_2_models
.
alloc
();
auto
&
integrator_lif
=
sim
->
qss3_integrator_models
.
alloc
();
auto
&
constant_lif
=
sim
->
constant_models
.
alloc
();
auto
&
constant_cross_lif
=
sim
->
constant_models
.
alloc
();
auto
&
cross_lif
=
sim
->
qss3_cross_models
.
alloc
();
sum_lif
.
default_input_coeffs
[
0
]
=
-
1.0
/
tau_lif
;
sum_lif
.
default_input_coeffs
[
1
]
=
20.0
/
tau_lif
;
constant_lif
.
default_value
=
1.0
;
constant_cross_lif
.
default_value
=
Vr_lif
;
integrator_lif
.
default_X
=
0.0
;
integrator_lif
.
default_dQ
=
quantum
;
cross_lif
.
default_threshold
=
Vt_lif
;
sim
->
alloc
(
sum_lif
,
sim
->
qss3_wsum_2_models
.
get_id
(
sum_lif
));
sim
->
alloc
(
integrator_lif
,
sim
->
qss3_integrator_models
.
get_id
(
integrator_lif
));
sim
->
alloc
(
constant_lif
,
sim
->
constant_models
.
get_id
(
constant_lif
));
sim
->
alloc
(
cross_lif
,
sim
->
qss3_cross_models
.
get_id
(
cross_lif
));
sim
->
alloc
(
constant_cross_lif
,
sim
->
constant_models
.
get_id
(
constant_cross_lif
));
struct
neuron
neuron_model
=
{
sim
->
qss3_wsum_2_models
.
get_id
(
sum_lif
),
sim
->
qss3_integrator_models
.
get_id
(
integrator_lif
),
sim
->
constant_models
.
get_id
(
constant_lif
),
sim
->
qss3_cross_models
.
get_id
(
cross_lif
),
sim
->
constant_models
.
get_id
(
constant_cross_lif
),
};
// Connections
expect
(
sim
->
connect
(
cross_lif
.
y
[
0
],
integrator_lif
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
cross_lif
.
y
[
1
],
sum_lif
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
integrator_lif
.
y
[
0
],
cross_lif
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
integrator_lif
.
y
[
0
],
cross_lif
.
x
[
2
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
constant_cross_lif
.
y
[
0
],
cross_lif
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
constant_lif
.
y
[
0
],
sum_lif
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
->
connect
(
sum_lif
.
y
[
0
],
integrator_lif
.
x
[
0
])
==
irt
::
status
::
success
);
return
neuron_model
;
}
void
lif_benchmark
(
double
simulation_duration
,
double
quantum
)
{
using
namespace
boost
::
ut
;
irt
::
simulation
sim
;
expect
(
irt
::
is_success
(
sim
.
init
(
2600lu
,
40000lu
)));
struct
neuron
neuron_model
=
make_neuron
(
&
sim
,
0.0
,
quantum
);
irt
::
time
t
=
0.0
;
std
::
string
file_name
=
"output_lif_qss3_sd_"
+
std
::
to_string
(
simulation_duration
)
+
"_q_"
+
std
::
to_string
(
quantum
)
+
".csv"
;
file_output
fo_a
(
file_name
.
c_str
());
expect
(
fo_a
.
os
!=
nullptr
);
auto
&
obs_a
=
sim
.
observers
.
alloc
(
0.01
,
"A"
,
static_cast
<
void
*>
(
&
fo_a
),
&
file_output_initialize
,
&
file_output_observe
,
nullptr
);
sim
.
observe
(
sim
.
models
.
get
(
sim
.
qss3_integrator_models
.
get
(
neuron_model
.
integrator
).
id
),
obs_a
);
expect
(
irt
::
status
::
success
==
sim
.
initialize
(
t
));
do
{
irt
::
status
st
=
sim
.
run
(
t
);
expect
(
st
==
irt
::
status
::
success
);
}
while
(
t
<
simulation_duration
);
}
void
izhikevich_benchmark
(
double
simulation_duration
,
double
quantum
,
double
a
,
double
b
,
double
c
,
double
d
,
double
I
,
double
vini
)
{
using
namespace
boost
::
ut
;
irt
::
simulation
sim
;
expect
(
irt
::
is_success
(
sim
.
init
(
1000lu
,
1000lu
)));
auto
&
constant
=
sim
.
constant_models
.
alloc
();
auto
&
constant2
=
sim
.
constant_models
.
alloc
();
auto
&
constant3
=
sim
.
constant_models
.
alloc
();
auto
&
sum_a
=
sim
.
qss3_wsum_2_models
.
alloc
();
auto
&
sum_b
=
sim
.
qss3_wsum_2_models
.
alloc
();
auto
&
sum_c
=
sim
.
qss3_wsum_4_models
.
alloc
();
auto
&
sum_d
=
sim
.
qss3_wsum_2_models
.
alloc
();
auto
&
product
=
sim
.
qss3_multiplier_models
.
alloc
();
auto
&
integrator_a
=
sim
.
qss3_integrator_models
.
alloc
();
auto
&
integrator_b
=
sim
.
qss3_integrator_models
.
alloc
();
auto
&
cross
=
sim
.
qss3_cross_models
.
alloc
();
auto
&
cross2
=
sim
.
qss3_cross_models
.
alloc
();
double
vt
=
30.0
;
constant
.
default_value
=
1.0
;
constant2
.
default_value
=
c
;
constant3
.
default_value
=
I
;
cross
.
default_threshold
=
vt
;
cross2
.
default_threshold
=
vt
;
integrator_a
.
default_X
=
vini
;
integrator_a
.
default_dQ
=
quantum
;
integrator_b
.
default_X
=
vini
;
integrator_b
.
default_dQ
=
quantum
;
sum_a
.
default_input_coeffs
[
0
]
=
1.0
;
sum_a
.
default_input_coeffs
[
1
]
=
-
1.0
;
sum_b
.
default_input_coeffs
[
0
]
=
-
a
;
sum_b
.
default_input_coeffs
[
1
]
=
a
*
b
;
sum_c
.
default_input_coeffs
[
0
]
=
0.04
;
sum_c
.
default_input_coeffs
[
1
]
=
5.0
;
sum_c
.
default_input_coeffs
[
2
]
=
140.0
;
sum_c
.
default_input_coeffs
[
3
]
=
1.0
;
sum_d
.
default_input_coeffs
[
0
]
=
1.0
;
sum_d
.
default_input_coeffs
[
1
]
=
d
;
sim
.
alloc
(
constant3
,
sim
.
constant_models
.
get_id
(
constant3
));
sim
.
alloc
(
constant
,
sim
.
constant_models
.
get_id
(
constant
));
sim
.
alloc
(
constant2
,
sim
.
constant_models
.
get_id
(
constant2
));
sim
.
alloc
(
sum_a
,
sim
.
qss3_wsum_2_models
.
get_id
(
sum_a
));
sim
.
alloc
(
sum_b
,
sim
.
qss3_wsum_2_models
.
get_id
(
sum_b
));
sim
.
alloc
(
sum_c
,
sim
.
qss3_wsum_4_models
.
get_id
(
sum_c
));
sim
.
alloc
(
sum_d
,
sim
.
qss3_wsum_2_models
.
get_id
(
sum_d
));
sim
.
alloc
(
product
,
sim
.
qss3_multiplier_models
.
get_id
(
product
));
sim
.
alloc
(
integrator_a
,
sim
.
qss3_integrator_models
.
get_id
(
integrator_a
));
sim
.
alloc
(
integrator_b
,
sim
.
qss3_integrator_models
.
get_id
(
integrator_b
));
sim
.
alloc
(
cross
,
sim
.
qss3_cross_models
.
get_id
(
cross
));
sim
.
alloc
(
cross2
,
sim
.
qss3_cross_models
.
get_id
(
cross2
));
expect
(
sim
.
connect
(
integrator_a
.
y
[
0
],
cross
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
constant2
.
y
[
0
],
cross
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
integrator_a
.
y
[
0
],
cross
.
x
[
2
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross
.
y
[
1
],
product
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross
.
y
[
1
],
product
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
product
.
y
[
0
],
sum_c
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross
.
y
[
1
],
sum_c
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross
.
y
[
1
],
sum_b
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
constant
.
y
[
0
],
sum_c
.
x
[
2
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
constant3
.
y
[
0
],
sum_c
.
x
[
3
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
sum_c
.
y
[
0
],
sum_a
.
x
[
0
])
==
irt
::
status
::
success
);
// expect(sim.connect(integrator_b.y[0], sum_a.x[1]) ==
// irt::status::success);
expect
(
sim
.
connect
(
cross2
.
y
[
1
],
sum_a
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
sum_a
.
y
[
0
],
integrator_a
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross
.
y
[
0
],
integrator_a
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross2
.
y
[
1
],
sum_b
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
sum_b
.
y
[
0
],
integrator_b
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
cross2
.
y
[
0
],
integrator_b
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
integrator_a
.
y
[
0
],
cross2
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
integrator_b
.
y
[
0
],
cross2
.
x
[
2
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
sum_d
.
y
[
0
],
cross2
.
x
[
1
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
integrator_b
.
y
[
0
],
sum_d
.
x
[
0
])
==
irt
::
status
::
success
);
expect
(
sim
.
connect
(
constant
.
y
[
0
],
sum_d
.
x
[
1
])
==
irt
::
status
::
success
);
std
::
string
file_name
=
"output_izhikevitch_qss3_a_sd_"
+
std
::
to_string
(
simulation_duration
)
+
"_q_"
+
std
::
to_string
(
quantum
)
+
"_a_"
+
std
::
to_string
(
a
)
+
"_b_"
+
std
::
to_string
(
b
)
+
"_c_"
+
std
::
to_string
(
c
)
+
"_d_"
+
std
::
to_string
(
d
)
+
".csv"
;
file_output
fo_a
(
file_name
.
c_str
());
expect
(
fo_a
.
os
!=
nullptr
);
auto
&
obs_a
=
sim
.
observers
.
alloc
(
0.01
,
"A"
,
static_cast
<
void
*>
(
&
fo_a
),
&
file_output_initialize
,
&
file_output_observe
,
nullptr
);
file_name
=
"output_izhikevitch_qss3_b_sd_"
+
std
::
to_string
(
simulation_duration
)
+
"_q_"
+
std
::
to_string
(
quantum
)
+
"_a_"
+
std
::
to_string
(
a
)
+
"_b_"
+
std
::
to_string
(
b
)
+
"_c_"
+
std
::
to_string
(
c
)
+
"_d_"
+
std
::
to_string
(
d
)
+
".csv"
;
file_output
fo_b
(
file_name
.
c_str
());
expect
(
fo_b
.
os
!=
nullptr
);
auto
&
obs_b
=
sim
.
observers
.
alloc
(
0.01
,
"B"
,
static_cast
<
void
*>
(
&
fo_b
),
&
file_output_initialize
,
&
file_output_observe
,
nullptr
);
sim
.
observe
(
sim
.
models
.
get
(
integrator_a
.
id
),
obs_a
);
sim
.
observe
(
sim
.
models
.
get
(
integrator_b
.
id
),
obs_b
);
irt
::
time
t
=
0.0
;
expect
(
irt
::
status
::
success
==
sim
.
initialize
(
t
));
!
expect
(
sim
.
sched
.
size
()
==
12
_ul
);
do
{
irt
::
status
st
=
sim
.
run
(
t
);
expect
(
st
==
irt
::
status
::
success
);
}
while
(
t
<
simulation_duration
);
};
BENCHMARK_P
(
LIF
,
QSS3
,
10
,
1
,(
double
simulation_duration
,
double
quantum
))
{
lif_benchmark
(
simulation_duration
,
quantum
);
}
BENCHMARK_P
(
Izhikevich
,
QSS3
,
1
,
1
,(
double
simulation_duration
,
double
quantum
,
double
a
,
double
b
,
double
c
,
double
d
,
double
I
,
double
vini
))
{
izhikevich_benchmark
(
simulation_duration
,
quantum
,
a
,
b
,
c
,
d
,
I
,
vini
);
}
BENCHMARK_P_INSTANCE
(
LIF
,
QSS3
,
(
1000
,
1e-6
));
// Regular spiking (RS)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.02
,
0.2
,
-
65.0
,
8.0
,
10.0
,
0.0
));
// Intrinsical bursting (IB)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.02
,
0.2
,
-
55.0
,
4.0
,
10.0
,
0.0
));
// Chattering spiking (CH)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.02
,
0.2
,
-
50.0
,
2.0
,
10.0
,
0.0
));
// Fast spiking (FS)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.1
,
0.2
,
-
65.0
,
2.0
,
10.0
,
0.0
));
// Thalamo-Cortical (TC)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.02
,
0.25
,
-
65.0
,
0.05
,
10.0
,
-
87.0
));
// Rezonator (RZ)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.1
,
0.26
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Low-threshold spiking (LTS)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.02
,
0.25
,
-
65.0
,
2.0
,
10.0
,
-
63.0
));
// Problematic (P)
BENCHMARK_P_INSTANCE
(
Izhikevich
,
QSS3
,
(
1000
,
1e-6
,
0.2
,
2
,
-
56.0
,
-
16.0
,
-
99.0
,
0.0
));
int
main
()
{
hayai
::
ConsoleOutputter
consoleOutputter
;
hayai
::
Benchmarker
::
AddOutputter
(
consoleOutputter
);
hayai
::
Benchmarker
::
RunAllTests
();
}
lib/benchmark/benchmark_timing_aqss.cpp
View file @
80f4f73e
...
...
@@ -151,7 +151,7 @@ parseMtxFile(std::string inputFileName) noexcept
is_general
?
inputFile
>>
m
>>
n
>>
data
:
inputFile
>>
m
>>
n
;
I
[
l
]
=
m
-
1
;
// mtx rows and columns are indexed from 1
J
[
l
]
=
n
-
1
;
K
[
l
]
=
is_general
?
data
:
0
.0
;
K
[
l
]
=
is_general
?
data
:
1
.0
;
}
inputFile
.
close
();
struct
mtx_matrix
matrix
=
{
M
,
N
,
NNZ
,
I
,
J
,
K
};
...
...
@@ -634,12 +634,20 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1
;
counter
++
;
}
}
matrix
=
{
n_dim
,
n_dim
,
n_dim
*
n_dim
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"empty"
)
{
double
*
I
=
new
double
[
n_dim
*
n_dim
];
double
*
J
=
new
double
[
n_dim
*
n_dim
];
double
*
NNZ
=
new
double
[
n_dim
*
n_dim
];
matrix
=
{
n_dim
,
n_dim
,
0
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"bipartite fully connected"
)
{
double
*
I
=
new
double
[
n_dim
*
m_dim
];
...
...
@@ -652,7 +660,7 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1
;
counter
++
;
}
}
...
...
@@ -805,6 +813,7 @@ BENCHMARK_P_INSTANCE(Network, matrix, (gener,"west0655.mtx",655,655,500,1e-5,0.1
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
gener
,
"jpwh_991.mtx"
,
991
,
991
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
gener
,
"fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
gener
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
gener
,
"empty"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
leaky_int_fire
,
"chesapeake.mtx"
,
39
,
39
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
leaky_int_fire
,
"celegansneural.mtx"
,
297
,
297
,
500
,
1e-5
,
0.1
,
250
));
...
...
@@ -812,6 +821,7 @@ BENCHMARK_P_INSTANCE(Network, matrix, (leaky_int_fire,"west0655.mtx",655,655,500
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
leaky_int_fire
,
"jpwh_991.mtx"
,
991
,
991
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
leaky_int_fire
,
"fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
leaky_int_fire
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
leaky_int_fire
,
"empty"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"chesapeake.mtx"
,
39
,
39
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"celegansneural.mtx"
,
297
,
297
,
500
,
1e-5
,
0.1
,
0.002
));
...
...
@@ -819,6 +829,7 @@ BENCHMARK_P_INSTANCE(Network, matrix, (izhikevich,"west0655.mtx",655,655,500,1e-
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"jpwh_991.mtx"
,
991
,
991
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
izhikevich
,
"fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
izhikevich
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
izhikevich
,
"empty"
,
10
,
10
,
500
,
1e-5
,
0.1
,
0.002
));
...
...
lib/benchmark/benchmark_timing_qss1.cpp
View file @
80f4f73e
...
...
@@ -151,7 +151,7 @@ parseMtxFile(std::string inputFileName) noexcept
is_general
?
inputFile
>>
m
>>
n
>>
data
:
inputFile
>>
m
>>
n
;
I
[
l
]
=
m
-
1
;
// mtx rows and columns are indexed from 1
J
[
l
]
=
n
-
1
;
K
[
l
]
=
is_general
?
data
:
0
.0
;
K
[
l
]
=
is_general
?
data
:
1
.0
;
}
inputFile
.
close
();
struct
mtx_matrix
matrix
=
{
M
,
N
,
NNZ
,
I
,
J
,
K
};
...
...
@@ -572,12 +572,20 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1.
0
;
counter
++
;
}
}
matrix
=
{
n_dim
,
n_dim
,
n_dim
*
n_dim
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"empty"
)
{
double
*
I
=
new
double
[
n_dim
*
n_dim
];
double
*
J
=
new
double
[
n_dim
*
n_dim
];
double
*
NNZ
=
new
double
[
n_dim
*
n_dim
];
matrix
=
{
n_dim
,
n_dim
,
0
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"bipartite fully connected"
)
{
double
*
I
=
new
double
[
n_dim
*
m_dim
];
...
...
@@ -590,7 +598,7 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1.
0
;
counter
++
;
}
}
...
...
@@ -740,20 +748,23 @@ BENCHMARK_P(Network, matrix, 1, 1,(neuron_type T,std::string matrix_name,int n_d
network
(
T
,
matrix_name
,
n_dim
,
m_dim
,
simulation_duration
,
quantum_synapse
,
quantum_neuron
,
spike_rate
);
}
/*BENCHMARK_P_INSTANCE(Network, matrix,(gener,"empty",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"chesapeake.mtx",39,39,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"celegansneural.mtx",297,297,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"west0655.mtx",655,655,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"jpwh_991.mtx",991,991,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix,(gener,"fully connected",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
gener
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE(Network, matrix,(gener,"bipartite fully connected",10,10,500,1e-5,0.1,250));
*/
/*BENCHMARK_P_INSTANCE(Network, matrix,(leaky_int_fire,"empty",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix,(leaky_int_fire,"chesapeake.mtx",39,39,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (leaky_int_fire,"celegansneural.mtx",297,297,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (leaky_int_fire,"west0655.mtx",655,655,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (leaky_int_fire,"jpwh_991.mtx",991,991,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix,(leaky_int_fire,"fully connected",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
leaky_int_fire
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE(Network, matrix,(leaky_int_fire,"bipartite fully connected",10,10,500,1e-5,0.1,250));
*/
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
izhikevich
,
"empty"
,
1000
,
1000
,
500
,
1e-5
,
0.1
,
0.02
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"chesapeake.mtx"
,
39
,
39
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"celegansneural.mtx"
,
297
,
297
,
500
,
1e-5
,
0.1
,
0.002
));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,
(
izhikevich
,
"west0655.mtx"
,
655
,
655
,
500
,
1e-5
,
0.1
,
0.002
));
...
...
lib/benchmark/benchmark_timing_qss2.cpp
View file @
80f4f73e
...
...
@@ -151,7 +151,7 @@ parseMtxFile(std::string inputFileName) noexcept
is_general
?
inputFile
>>
m
>>
n
>>
data
:
inputFile
>>
m
>>
n
;
I
[
l
]
=
m
-
1
;
// mtx rows and columns are indexed from 1
J
[
l
]
=
n
-
1
;
K
[
l
]
=
is_general
?
data
:
0
.0
;
K
[
l
]
=
is_general
?
data
:
1
.0
;
}
inputFile
.
close
();
struct
mtx_matrix
matrix
=
{
M
,
N
,
NNZ
,
I
,
J
,
K
};
...
...
@@ -572,12 +572,20 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1.
0
;
counter
++
;
}
}
matrix
=
{
n_dim
,
n_dim
,
n_dim
*
n_dim
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"empty"
)
{
double
*
I
=
new
double
[
n_dim
*
n_dim
];
double
*
J
=
new
double
[
n_dim
*
n_dim
];
double
*
NNZ
=
new
double
[
n_dim
*
n_dim
];
matrix
=
{
n_dim
,
n_dim
,
0
,
I
,
J
,
NNZ
};
}
else
if
(
matrix_name
==
"bipartite fully connected"
)
{
double
*
I
=
new
double
[
n_dim
*
m_dim
];
...
...
@@ -590,7 +598,7 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
{
I
[
counter
]
=
i
;
J
[
counter
]
=
j
;
NNZ
[
counter
]
=
0
;
NNZ
[
counter
]
=
1.
0
;
counter
++
;
}
}
...
...
@@ -655,7 +663,7 @@ void network(neuron_type T, std::string matrix_name,int n_dim, int m_dim, double
break
;
case
izhikevich
:
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
struct
neuron_izhikevich
neuron_model
=
make_neuron_izhikevich
(
&
sim
,
i
,
quantum_neuron
,(
spike_rate
/
2.0
)
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
spike_rate
/
2.0
))),
0.2
,
-
65.0
,
8.0
,
10.0
,
0.0
);
struct
neuron_izhikevich
neuron_model
=
make_neuron_izhikevich
(
&
sim
,
i
,
quantum_neuron
,
spike_rate
/*
(spike_rate/2.0) + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(spike_rate/2.0)))
*/
,
0.2
,
-
65.0
,
8.0
,
10.0
,
0.0
);
neurons_izhikevich
.
emplace_back
(
neuron_model
);
}
break
;
...
...
@@ -740,26 +748,29 @@ BENCHMARK_P(Network, matrix, 1, 1,(neuron_type T,std::string matrix_name,int n_d
network
(
T
,
matrix_name
,
n_dim
,
m_dim
,
simulation_duration
,
quantum_synapse
,
quantum_neuron
,
spike_rate
);
}
/*BENCHMARK_P_INSTANCE(Network, matrix,(gener,"empty",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"chesapeake.mtx",39,39,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"celegansneural.mtx",297,297,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"west0655.mtx",655,655,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix, (gener,"jpwh_991.mtx",991,991,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE(Network, matrix,(gener,"fully connected",10,10,500,1e-5,0.1,250));
BENCHMARK_P_INSTANCE
(
Network
,
matrix
,(
gener
,
"bipartite fully connected"
,
10
,
10
,
500
,
1e-5
,
0.1
,
250
));
BENCHMARK_P_INSTANCE(Network, matrix,(gener,"bipartite fully connected",10,10,500,1e-5,0.1,250));
*/
/*BENCHMARK_P_INSTANCE(Network, matrix,(leaky_int_fire,"empty",1000,1000,500,1e-5,0.1,250));