1/* 2 * ticket-881.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/** @BeginDocumentation 24 25Name: testsuite::ticket-881 - ConnectLayers creates too few connections under some conditions when running on multiple threads 26 27Synopsis: (ticket-881) run -> NEST exits if test fails 28 29Description: 30This tests creates a small layer, connects it all-to-all and checks if all expected connections have been created. 31 32This is a regression from nest-2.2.2 to 10kproject@r11284 (precise location unknown so far) 33Author: Hans Ekkehard Plesser 34*/ 35 36 37(unittest) run 38/unittest using 39 40M_ERROR setverbosity 41 42/num_threads 4 def 43/node_pos [ [0.0 0.0] [0.0 0.0] [0.0 0.0] [0.0 0.0] ] def 44/num_nodes node_pos length def 45 46/num_expected num_nodes dup mul def % all to all 47 48% Test 1: pairwise pairwise_bernoulli_on_source 49{ 50 ResetKernel 51 << /local_num_threads num_threads >> SetKernelStatus 52 53 << /elements /iaf_psc_alpha /positions node_pos >> CreateLayer 54 dup 55 << /connection_type (pairwise_bernoulli_on_source) >> ConnectLayers 56 57 << >> GetConnections length num_expected eq 58} assert_or_die 59 60% Test 2: pairwise pairwise_bernoulli_on_target 61{ 62 ResetKernel 63 << /local_num_threads num_threads >> SetKernelStatus 64 65 << /elements /iaf_psc_alpha /positions node_pos >> CreateLayer 66 dup 67 << /connection_type (pairwise_bernoulli_on_target) >> ConnectLayers 68 69 << >> GetConnections length num_expected eq 70} assert_or_die 71 72% Test 3: fixed fan-in 73{ 74 ResetKernel 75 << /local_num_threads num_threads >> SetKernelStatus 76 77 << /elements /iaf_psc_alpha /positions node_pos >> CreateLayer 78 dup 79 << /connection_type (pairwise_bernoulli_on_source) /number_of_connections num_nodes >> ConnectLayers 80 81 << >> GetConnections length num_expected eq 82} assert_or_die 83 84% Test 4: fixed fan-out 85{ 86 ResetKernel 87 << /local_num_threads num_threads >> SetKernelStatus 88 89 << /elements /iaf_psc_alpha /positions node_pos >> CreateLayer 90 dup 91 << /connection_type (pairwise_bernoulli_on_target) /number_of_connections num_nodes >> ConnectLayers 92 93 << >> GetConnections length num_expected eq 94} assert_or_die 95 96 97 98endusing 99