1/*
2 *  issue-211.sli
3 *
4 *  This file is part of NEST.
5 *
6 *  Copyright (C) 2004 The NEST Initiative
7 *
8 *  NEST is free software: you can redistribute it and/or modify
9 *  it under the terms of the GNU General Public License as published by
10 *  the Free Software Foundation, either version 2 of the License, or
11 *  (at your option) any later version.
12 *
13 *  NEST is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *  GNU General Public License for more details.
17 *
18 *  You should have received a copy of the GNU General Public License
19 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 /** @BeginDocumentation
25Name: testsuite::test_threaded_neuron_device_connections - test for correct creation of neuron-neuron, neuron-device, device-neuron and device-device connections using multiple threads
26
27Synopsis: (test_threaded_neuron_device_connections) run -> dies if assertion fails
28
29Description:
30this script creates connections between neurons and devices and checks whether the actually created connections coincide with the expected connections
31
32Author: Jakob Jordan
33FirstVersion: January 2016
34SeeAlso:
35*/
36
37(unittest) run
38/unittest using
39
40skip_if_not_threaded
41
42M_ERROR setverbosity
43
44ResetKernel
45<< /total_num_virtual_procs 2 >> SetKernelStatus
46
47% create nodes
48/n1 /iaf_psc_delta Create def
49/n2 /iaf_psc_delta Create def
50/n3 /iaf_psc_delta Create def
51/r4 /spike_recorder Create def
52/g5 /spike_generator Create def
53/v6 /volume_transmitter Create def
54/stdp_dopamine_synapse << /vt v6 0 get >> SetDefaults
55
56% neuron-neuron
57n1 n3 Connect
58n2 n3 Connect
59n2 n1 Connect
60n3 n1 Connect
61n2 n1 << >> << /weight 1. >> Connect
62
63% neuron-device
64n1 r4 Connect
65n1 n3 Connect
66n2 r4 Connect
67n3 r4 Connect
68n2 r4 << >> << /weight 1. >> Connect
69
70% device-neuron
71g5 n2 Connect
72g5 n3 Connect
73g5 n1 Connect
74g5 n1 Connect
75g5 n3 << >> << /weight 1. >> Connect
76
77% device-device
78g5 r4 Connect
79g5 r4 Connect
80g5 r4 Connect
81g5 r4 << >> << /weight 1. >> Connect
82
83% neuron-globally receiving device (volume transmitter)
84n1 v6 Connect
85n2 v6 Connect
86
87/conn << >> GetConnections def
88% expected connections with expected threads
89/target_conn <[1 3 1] [2 3 1] [2 1 1] [3 1 1] [2 1 1] % neuron-neuron
90              [1 4 1] [1 3 1] [2 4 0] [3 4 1] [2 4 0] % neuron-device
91              [5 2 0] [5 3 1] [5 1 1] [5 1 1] [5 3 1] % device-neuron
92              [5 4 0] [5 4 0] [5 4 0] [5 4 0]         % device-device
93              [1 6 0] [1 6 1] [2 6 0] [2 6 1]> def    % neuron-globally receiving device
94
95conn {
96  target_conn exch cva [[1 2 3]] Part MemberQ assert
97} forall
98conn length_a target_conn length_a eq assert
99