Skip to content

Commit

Permalink
Merge pull request #710 from IGITUGraz/iss696
Browse files Browse the repository at this point in the history
Fix connections to music_event_out_proxy for local_num_threads > 1 (#710, #696)
  • Loading branch information
jougs authored Apr 25, 2017
2 parents efd79cb + b39ee03 commit b8ad1a5
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nestkernel/connection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ nest::ConnectionManager::connect( index sgid,
return;
}

if ( target->one_node_per_process() )
{
// connection to music proxy or similar device with one node per process.
connect_( *source, *target, sgid, target_thread, syn, d, w );
return;
}

// make sure connections are only created on the thread of the device
if ( ( source->get_thread() != target_thread )
&& ( source->has_proxies() ) )
Expand Down Expand Up @@ -459,6 +466,13 @@ nest::ConnectionManager::connect( index sgid,
return;
}

if ( target->one_node_per_process() )
{
// connection to music proxy or similar device with one node per process.
connect_( *source, *target, sgid, target_thread, syn, params, d, w );
return;
}

// make sure connections are only created on the thread of the device
if ( ( source->get_thread() != target_thread )
&& ( source->has_proxies() ) )
Expand Down Expand Up @@ -527,6 +541,13 @@ nest::ConnectionManager::connect( index sgid,
return false;
}

if ( target->one_node_per_process() )
{
// connection to music proxy or similar device with one node per process.
connect_( *source, *target, sgid, target_thread, syn, params );
return true;
}

// make sure connections are only created on the thread of the device
if ( ( source->get_thread() != target_thread )
&& ( source->has_proxies() ) )
Expand Down
33 changes: 33 additions & 0 deletions testsuite/musictests/test_event_proxies_issue-696.music
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* test_event_proxies_issue-696.music
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/

[sender]
binary=nest
np=1
args=test_event_proxies_issue-696_sender.sli

[receiver]
binary=nest
np=1
args=test_event_proxies_issue-696_receiver.sli

sender.out -> receiver.in [11]
53 changes: 53 additions & 0 deletions testsuite/musictests/test_event_proxies_issue-696_receiver.sli
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* test_event_proxies_issue-696_receiver.sli
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/

(unittest) run
/unittest using

statusdict/have_music :: not { exit_test_gracefully } if

M_ERROR setverbosity

11 /N_NEURONS Set

/subnet Create /NG Set
NG ChangeSubnet
/iaf_psc_alpha N_NEURONS Create pop
0 ChangeSubnet
NG GetGlobalNodes /neurons Set

/subnet Create /INP Set
INP ChangeSubnet
/music_event_in_proxy N_NEURONS Create pop
0 ChangeSubnet
INP GetGlobalNodes /inputs Set

inputs
{
/channel Set
/n Set
n << /port_name (in) /music_channel channel >> SetStatus
n neurons channel get << /weight 750.0 >> Connect
}
forallindexed

1 Simulate
65 changes: 65 additions & 0 deletions testsuite/musictests/test_event_proxies_issue-696_sender.sli
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* test_event_proxies_issue-696_sender.sli
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/

(unittest) run
/unittest using

statusdict/have_music :: not { exit_test_gracefully } if

M_ERROR setverbosity

10 /N_THREADS Set
11 /N_NEURONS Set

0 << /local_num_threads N_THREADS /resolution 0.1 >> SetStatus

/subnet Create /SNG Set
SNG ChangeSubnet
/spike_generator N_NEURONS Create pop
0 ChangeSubnet
SNG GetGlobalNodes /generators Set

/subnet Create /PNG Set
PNG ChangeSubnet
/parrot_neuron N_NEURONS Create pop
0 ChangeSubnet
PNG GetGlobalNodes /neurons Set
generators
{
/i Set /sg Set
sg << /spike_times [0.1 0.2 0.3] >> SetStatus
sg neurons i get << /delay 0.1 >> Connect
}
forallindexed

/music_event_out_proxy Create /meop Set
meop << /port_name (out) >> SetStatus

neurons
{
/channel Set
/n Set
n meop << /music_channel channel >> Connect
}
forallindexed

1 Simulate

0 comments on commit b8ad1a5

Please sign in to comment.