Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arbor-sim
arbor
Commits
68569c59
Commit
68569c59
authored
8 years ago
by
w-klijn
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #81 from eth-cscs/exporter_fixes
Global and Local spike exchange streamline
parents
0325614b
e743030b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
miniapp/io.cpp
+2
-2
2 additions, 2 deletions
miniapp/io.cpp
miniapp/io.hpp
+1
-1
1 addition, 1 deletion
miniapp/io.hpp
miniapp/miniapp.cpp
+19
-25
19 additions, 25 deletions
miniapp/miniapp.cpp
src/model.hpp
+5
-6
5 additions, 6 deletions
src/model.hpp
with
27 additions
and
34 deletions
miniapp/io.cpp
+
2
−
2
View file @
68569c59
...
...
@@ -132,7 +132,7 @@ cl_options read_options(int argc, char** argv) {
true
,
// Overwrite outputfile if exists
"./"
,
// output path
"spikes"
,
// file name
"gdf"
// file exten
t
ion
"gdf"
// file exten
s
ion
};
cl_options
options
;
...
...
@@ -218,7 +218,7 @@ cl_options read_options(int argc, char** argv) {
update_option
(
options
.
over_write
,
fopts
,
"over_write"
);
update_option
(
options
.
output_path
,
fopts
,
"output_path"
);
update_option
(
options
.
file_name
,
fopts
,
"file_name"
);
update_option
(
options
.
file_exten
t
ion
,
fopts
,
"file_exten
t
ion"
);
update_option
(
options
.
file_exten
s
ion
,
fopts
,
"file_exten
s
ion"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
miniapp/io.hpp
+
1
−
1
View file @
68569c59
...
...
@@ -32,7 +32,7 @@ struct cl_options {
bool
over_write
;
std
::
string
output_path
;
std
::
string
file_name
;
std
::
string
file_exten
t
ion
;
std
::
string
file_exten
s
ion
;
};
class
usage_error
:
public
std
::
runtime_error
{
...
...
This diff is collapsed.
Click to expand it.
miniapp/miniapp.cpp
+
19
−
25
View file @
68569c59
...
...
@@ -69,36 +69,30 @@ int main(int argc, char** argv) {
model_type
m
(
*
recipe
,
cell_range
.
first
,
cell_range
.
second
);
// File output is depending on the input arguments
std
::
unique_ptr
<
file_export_type
>
file_exporter
;
std
::
function
<
void
(
const
std
::
vector
<
spike_type
>&
)
>
do_nothing
{
util
::
nop_function
};
if
(
!
options
.
spike_file_output
)
{
m
.
set_global_spike_callback
(
do_nothing
);
m
.
set_local_spike_callback
(
do_nothing
);
}
else
{
// The exporter is the same for both global and local output
// just registered as a different callback
file_exporter
=
auto
register_exporter
=
[]
(
const
io
::
cl_options
&
options
)
{
return
util
::
make_unique
<
file_export_type
>
(
options
.
file_name
,
options
.
output_path
,
options
.
file_extention
,
options
.
over_write
);
options
.
file_extension
,
options
.
over_write
);
};
// File output is depending on the input arguments
std
::
unique_ptr
<
file_export_type
>
file_exporter
;
if
(
options
.
spike_file_output
)
{
if
(
options
.
single_file_per_rank
)
{
m
.
set_global_spike_callback
(
do_nothing
);
m
.
set_local_spike_callback
(
[
&
](
const
std
::
vector
<
spike_type
>&
spikes
)
{
file_exporter
->
output
(
spikes
);
});
}
else
{
m
.
set_global_spike_callback
(
[
&
](
const
std
::
vector
<
spike_type
>&
spikes
)
{
file_exporter
=
register_exporter
(
options
);
m
.
set_local_spike_callback
(
[
&
](
const
std
::
vector
<
spike_type
>&
spikes
)
{
file_exporter
->
output
(
spikes
);
});
m
.
set_local_spike_callback
(
do_nothing
);
}
});
}
else
if
(
communication
::
global_policy
::
id
()
==
0
)
{
file_exporter
=
register_exporter
(
options
);
m
.
set_global_spike_callback
(
[
&
](
const
std
::
vector
<
spike_type
>&
spikes
)
{
file_exporter
->
output
(
spikes
);
});
}
}
// inject some artificial spikes, 1 per 20 neurons.
...
...
This diff is collapsed.
Click to expand it.
src/model.hpp
+
5
−
6
View file @
68569c59
...
...
@@ -14,6 +14,7 @@
#include
<profiling/profiler.hpp>
#include
<recipe.hpp>
#include
<thread_private_spike_store.hpp>
#include
<util/nop.hpp>
#include
"trace_sampler.hpp"
...
...
@@ -139,8 +140,8 @@ public:
PE
(
"stepping"
,
"exchange"
);
auto
local_spikes
=
previous_spikes
().
gather
();
local_export_callback_
(
local_spikes
);
future_events
()
=
communicator_
.
exchange
(
local_spikes
,
global_export_callback_
);
future_events
()
=
communicator_
.
exchange
(
local_spikes
,
global_export_callback_
);
PL
(
2
);
};
...
...
@@ -182,14 +183,12 @@ public:
// register a callback that will perform a export of the global
// spike vector
void
set_global_spike_callback
(
spike_export_function
export_callback
)
{
global_export_callback_
=
export_callback
;
}
// register a callback that will perform a export of the rank local
// spike vector
void
set_local_spike_callback
(
spike_export_function
export_callback
)
{
local_export_callback_
=
export_callback
;
}
...
...
@@ -207,8 +206,8 @@ private:
using
local_spike_store_type
=
thread_private_spike_store
<
time_type
>
;
util
::
double_buffer
<
local_spike_store_type
>
local_spikes_
;
spike_export_function
global_export_callback_
;
spike_export_function
local_export_callback_
;
spike_export_function
global_export_callback_
=
util
::
nop_function
;
spike_export_function
local_export_callback_
=
util
::
nop_function
;
// Convenience functions that map the spike buffers and event queues onto
// the appropriate integration interval.
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment