Skip to content

Commit

Permalink
Fixes #281: Topology does not attempt to proxies for non-local nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
heplesser committed Mar 18, 2016
1 parent e1dd8a8 commit 6fa4fd1
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
62 changes: 62 additions & 0 deletions testsuite/mpitests/issue-281.sli
@@ -0,0 +1,62 @@
/*
* issue-281.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/>.
*
*/

/* BeginDocumentation

Name: testsuite::issue-281 - Check that ConnectLayers works MPI-parallel for fixed fan-out

Synopsis: (issue-281) run -> NEST exits if test fails

Description:
This test connects a layer with itself with fixed fan-out.
The test should pass with any number of MPI processes.

Author: Hans Ekkehard Plesser, 2016-03-18
*/

(unittest) run
/unittest using

[1 2 4]
{
<<
/rows 3
/columns 3
/elements /iaf_neuron
>>
CreateLayer
dup

<<
/connection_type /divergent
/number_of_connections 10

% weights are randomized to check that global RNGs stay in sync
/weights << /uniform << /min 1. /max 2. >> >>
>>
ConnectLayers

% Simulate call required to provoke global-rng-sync-check.
10 Simulate
}
distributed_pass_or_die

12 changes: 11 additions & 1 deletion topology/connection_creator_impl.h
Expand Up @@ -741,9 +741,19 @@ ConnectionCreator::divergent_connect_( Layer< D >& source, Layer< D >& target )
}
Position< D > target_displ = displacements[ random_id ];
index target_id = targets[ random_id ];
Node* target_ptr = kernel().node_manager.get_node( target_id );

double w, d;
get_parameters_( target_displ, get_global_rng(), w, d );

// We bail out for non-local neurons only now after all possible
// random numbers haven been drawn. Bailing out any earlier may lead
// to desynchronized global rngs.
if ( not kernel().node_manager.is_local_gid( target_id ) )
{
continue;
}

Node* target_ptr = kernel().node_manager.get_node( target_id );
kernel().connection_builder_manager.connect(
source_id, target_ptr, target_ptr->get_thread(), synapse_model_, d, w );
is_selected[ random_id ] = true;
Expand Down

0 comments on commit 6fa4fd1

Please sign in to comment.