Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testsuite::issue-521 - *_hpc connections return local id instead of g… #714

Merged
merged 27 commits into from Jun 21, 2017
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b63fb99
new start for 10k release
tillschumann Aug 25, 2015
231d1da
ifdef for BQG inserted
tillschumann Aug 25, 2015
6d7b542
typedef for int32 and int64
tillschumann Aug 25, 2015
9a1f189
missing type fixed
tillschumann Aug 25, 2015
e57694f
typedef changed
tillschumann Aug 25, 2015
560ca6a
mempredictor output instead of bad alloc for std allocs
tillschumann Aug 25, 2015
b6aa8b9
new thread connect
tillschumann Sep 3, 2015
8ad57ea
Merge remote-tracking branch 'refs/remotes/origin/master'
Nov 3, 2016
d988071
Merge remote-tracking branch 'upstream/master'
Nov 3, 2016
83049be
sync with upstream
Nov 3, 2016
c4a71c0
testsuite::issue-521 - *_hpc connections return local id instead of g…
Apr 24, 2017
79aa6c6
Merge remote-tracking branch 'upstream/master' into issue_521
Apr 24, 2017
3afc16a
Merge remote-tracking branch 'upstream/master' into issue_521
Apr 24, 2017
1790c99
clang style fixed
May 5, 2017
5d67f07
Merge branch 'issue_521' of https://github.com/tillschumann/nest-simu…
May 5, 2017
8393522
Suggest changes for PR #714
May 15, 2017
ae9062b
Merge pull request #1 from suku248/issue_521_2
tillschumann May 29, 2017
d39c8a4
changes reversed and tests adapted according to S. Kunkel
May 29, 2017
a275cf3
changes reversed and tests adapted according to S. Kunkel
May 29, 2017
3b628d4
Merge branch 'issue_521' of https://github.com/tillschumann/nest-simu…
May 29, 2017
44ad357
Merge branch 'issue_521' of https://github.com/tillschumann/nest-simu…
May 29, 2017
618b42c
Merge branch 'issue_521' of https://github.com/tillschumann/nest-simu…
May 29, 2017
e9e34d2
Merge branch 'master' of https://github.com/nest/nest-simulator
Jun 7, 2017
24da748
integrate comments
Jun 9, 2017
11077fe
Merge branch 'master' of https://github.com/nest/nest-simulator
Jun 9, 2017
dc6cf77
Merge branch 'master' into issue_521
Jun 9, 2017
6b0e686
Update issue-521.sli
heplesser Jun 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion nestkernel/connection_manager.cpp
Expand Up @@ -165,7 +165,7 @@ nest::ConnectionManager::get_synapse_status( index gid,

DictionaryDatum dict( new Dictionary );
validate_pointer( connections_[ tid ].get( gid ) )
->get_synapse_status( syn_id, dict, p );
->get_synapse_status( syn_id, dict, p, tid );
( *dict )[ names::source ] = gid;
( *dict )[ names::synapse_model ] = LiteralDatum(
kernel().model_manager.get_synapse_prototype( syn_id ).get_name() );
Expand Down
34 changes: 27 additions & 7 deletions nestkernel/connector_base.h
Expand Up @@ -135,8 +135,10 @@ class ConnectorBase
public:
ConnectorBase();

virtual void
get_synapse_status( synindex syn_id, DictionaryDatum& d, port p ) const = 0;
virtual void get_synapse_status( synindex syn_id,
DictionaryDatum& d,
port p,
const thread tid ) const = 0;
virtual void set_synapse_status( synindex syn_id,
ConnectorModel& cm,
const DictionaryDatum& d,
Expand Down Expand Up @@ -300,12 +302,17 @@ class Connector : public vector_like< ConnectionT >
}

void
get_synapse_status( synindex syn_id, DictionaryDatum& d, port p ) const
get_synapse_status( synindex syn_id,
DictionaryDatum& d,
port p,
const thread tid ) const
{
if ( syn_id == C_[ 0 ].get_syn_id() )
{
assert( p >= 0 && static_cast< size_t >( p ) < K );
C_[ p ].get_status( d );
// set target gid here, where tid is available
def< long >( d, names::target, C_[ p ].get_target( tid )->get_gid() );
}
}

Expand Down Expand Up @@ -583,12 +590,17 @@ class Connector< 1, ConnectionT > : public vector_like< ConnectionT >
}

void
get_synapse_status( synindex syn_id, DictionaryDatum& d, port p ) const
get_synapse_status( synindex syn_id,
DictionaryDatum& d,
port p,
const thread tid ) const
{
if ( syn_id == C_[ 0 ].get_syn_id() )
{
assert( static_cast< size_t >( p ) == 0 );
C_[ 0 ].get_status( d );
// set target gid here, where tid is available
def< long >( d, names::target, C_[ 0 ].get_target( tid )->get_gid() );
}
}

Expand Down Expand Up @@ -834,12 +846,17 @@ class Connector< K_CUTOFF, ConnectionT > : public vector_like< ConnectionT >
}

void
get_synapse_status( synindex syn_id, DictionaryDatum& d, port p ) const
get_synapse_status( synindex syn_id,
DictionaryDatum& d,
port p,
const thread tid ) const
{
if ( syn_id == C_[ 0 ].get_syn_id() )
{
assert( p >= 0 && static_cast< size_t >( p ) < C_.size() );
C_[ p ].get_status( d );
// set target gid here, where tid is available
def< long >( d, names::target, C_[ p ].get_target( tid )->get_gid() );
}
}

Expand Down Expand Up @@ -1080,11 +1097,14 @@ class HetConnector : public std::vector< ConnectorBase* >, public ConnectorBase
}

void
get_synapse_status( synindex syn_id, DictionaryDatum& d, port p ) const
get_synapse_status( synindex syn_id,
DictionaryDatum& d,
port p,
const thread tid ) const
{
for ( size_t i = 0; i < size(); i++ )
{
at( i )->get_synapse_status( syn_id, d, p );
at( i )->get_synapse_status( syn_id, d, p, tid );
}
}

Expand Down
77 changes: 77 additions & 0 deletions testsuite/regressiontests/issue-521.sli
@@ -0,0 +1,77 @@
/*
* issue-521.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-521 - *_hpc connections return local id instead of global id of target neuron

*_hpc connections should only return thread_local_target instead of target
to avoid confusion

FirstVersion: 04/2017
Author: Till Schumann
*/

(unittest) run
/unittest using

skip_if_not_threaded

/test_targets
{
dup /threads Set
ResetKernel
0 << /local_num_threads threads >> SetStatus


% create set of neurons
/iaf_psc_alpha 20 Create

% connect two neurons (prime number to increase variations of thread placement)
5 13 /static_synapse Connect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any special significance to using neurons 5 and 13? If so, it would be good to explain it briefly.

5 13 /static_synapse_hpc Connect

% store info from target neuron for comparison
13 GetStatus /target_dict Set

<< >> GetConnections 0 get GetStatus /conn_dict Set
<< >> GetConnections 1 get GetStatus /conn_hpc_dict Set


/* normal connection should contain global_id as target */
conn_dict /target get target_dict /global_id get eq assert_or_die

/* same for hpc connection */
conn_hpc_dict /target get target_dict /global_id get eq assert_or_die


} def


/* test runs with different number of threads */
1 test_targets
2 test_targets
4 test_targets
8 test_targets
16 test_targets

endusing