diff --git a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_source.sli b/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_source.sli deleted file mode 100644 index 335823ce11..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_source.sli +++ /dev/null @@ -1,76 +0,0 @@ -/* - * topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_source.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_source /number_of_connections 10 >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_target.sli b/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_target.sli deleted file mode 100644 index ec4822b7f1..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_target.sli +++ /dev/null @@ -1,76 +0,0 @@ -/* - * topo_mpi_test_free_layer_to_layer_pairwise_bernoulli_on_target.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_target /number_of_connections 10 >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_source_driven.sli b/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_source_driven.sli deleted file mode 100644 index 2883545f84..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_source_driven.sli +++ /dev/null @@ -1,76 +0,0 @@ -/* - * topo_mpi_test_free_layer_to_layer_source_driven.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_target >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_target_driven.sli b/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_target_driven.sli deleted file mode 100644 index 5983670a52..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_layer_to_layer_target_driven.sli +++ /dev/null @@ -1,76 +0,0 @@ -/* - * topo_mpi_test_free_layer_to_layer_target_driven.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_source >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_layer_to_sd_target_driven.sli b/testsuite/mpitests/topo_mpi_test_free_layer_to_sd_target_driven.sli deleted file mode 100644 index 364e528752..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_layer_to_sd_target_driven.sli +++ /dev/null @@ -1,77 +0,0 @@ -/* - * topo_mpi_test_free_layer_to_sd_target_driven.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_spec_b - << - /positions [[0.0 0.0]] - /extent [1.0 1.0] - /edge_wrap false - /elements /spike_recorder - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_source >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_source.sli b/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_source.sli deleted file mode 100644 index e9bf861e74..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_source.sli +++ /dev/null @@ -1,78 +0,0 @@ -/* - * topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_source.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << - /positions [[0.0 0.0]] - /extent [1.0 1.0] - /edge_wrap false - /elements /poisson_generator - >> def - - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_source /number_of_connections 10 >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_target.sli b/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_target.sli deleted file mode 100644 index 083c92a82b..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_target.sli +++ /dev/null @@ -1,78 +0,0 @@ -/* - * topo_mpi_test_free_pg_to_layer_pairwise_bernoulli_on_target.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << - /positions [[0.0 0.0]] - /extent [1.0 1.0] - /edge_wrap false - /elements /poisson_generator - >> def - - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_target /number_of_connections 10 >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_source_driven.sli b/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_source_driven.sli deleted file mode 100644 index a4159fba55..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_source_driven.sli +++ /dev/null @@ -1,78 +0,0 @@ -/* - * topo_mpi_test_free_pg_to_layer_source_driven.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << - /positions [[0.0 0.0]] - /extent [1.0 1.0] - /edge_wrap false - /elements /poisson_generator - >> def - - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_target >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_target_driven.sli b/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_target_driven.sli deleted file mode 100644 index 4468c0a151..0000000000 --- a/testsuite/mpitests/topo_mpi_test_free_pg_to_layer_target_driven.sli +++ /dev/null @@ -1,78 +0,0 @@ -/* - * topo_mpi_test_free_pg_to_layer_target_driven.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 . - * - */ - - - /* -Author: Håkon Mørk -FirstVersion: 16. November 2017 -*/ - -(unittest) run -/unittest using - -skip_if_not_threaded - -/test_connection -{ - /connspec Set - - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - - [-0.5 0.5 0.25] Range - { /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten - /pos Set - - /layer_spec_a - << - /positions [[0.0 0.0]] - /extent [1.0 1.0] - /edge_wrap false - /elements /poisson_generator - >> def - - - /layer_spec_b - << /positions pos - /extent [1.25 1.25] - /edge_wrap false - /elements /iaf_psc_alpha - >> def - - /layer_a layer_spec_a CreateLayer def - /layer_b layer_spec_b CreateLayer def - - layer_a layer_b connspec ConnectLayers - - /src layer_a 1 Take def - /tgts layer_b def - /conns << /source src >> GetConnections def - /ctgts conns { cva 1 get } Map def - - ctgts cva - -} def - -[1 2 4] -{ - << /connection_type /pairwise_bernoulli_on_source >> test_connection -} distributed_process_invariant_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_source.sli b/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_source.sli deleted file mode 100644 index 347577941f..0000000000 --- a/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_source.sli +++ /dev/null @@ -1,100 +0,0 @@ -/* - * topo_mpi_test_pairwise_bernoulli_on_source.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 . - * - */ - -skip_if_not_threaded - -(unittest) run -/unittest using - -% pairwise_bernoulli_on_source test -[1 2 4] -{ - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - /layer_specs << /shape [ 4 4 ] /elements /iaf_psc_alpha /edge_wrap true >> def - /l1 layer_specs CreateLayer def - /l2 layer_specs CreateLayer def - - << /constant << /value 1.0 >> >> CreateParameter - << /constant << /value -0.02 >> >> CreateParameter - << /distance << >> >> CreateParameter - mul add /linear_parameter Set - - /conns << /connection_type (pairwise_bernoulli_on_source) - /mask << /circular << /radius 0.25 >> /anchor [ 0.0 0.0 ] >> - /weight linear_parameter - >> def - l1 l2 conns ConnectLayers - - /ofile tmpnam (_) join Rank 1 add cvs join (_of_) join NumProcesses cvs join def - ofile (w) file - l1 DumpLayerNodes - l2 DumpLayerNodes - l1 l2 /static_synapse DumpLayerConnections close - ofile -} -{ - /result_files Set - result_files == - - % Use the first result as reference - /ref [] def - result_files First 0 get dup /ref_filename Set (r) file - { - getline not - {exit} if % exit loop if EOF - ref exch append - /ref Set - } loop - close - (Num elements: ) ref length_a cvs join = - - % Compare the reference to the other results - /other_results [] def - result_files Rest - { - /result [] def - /n_elements 0 def - { - dup /filename Set - (r) file - { - getline - not {exit} if % exit loop if EOF - dup ref exch MemberQ dup /invariant Set - not {cvs ( not in ref ) join ref_filename join = exit} if % break out of loop if element not in reference - result exch append - /result Set - /n_elements n_elements 1 add def - } loop - close - invariant not {exit} if - } forall - n_elements ref length_a eq not - {/invariant false def (Lengths not equal, ) n_elements cvs join ( and ) join ref length_a cvs join = } if - invariant not {exit} if - /other_results other_results result append def - } forall - - invariant % true if all runs produce the same elements - -} distributed_collect_assert_or_die diff --git a/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_target.sli b/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_target.sli deleted file mode 100644 index 7fa6025d98..0000000000 --- a/testsuite/mpitests/topo_mpi_test_pairwise_bernoulli_on_target.sli +++ /dev/null @@ -1,100 +0,0 @@ -/* - * topo_mpi_test_pairwise_bernoulli_on_target.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 . - * - */ - -skip_if_not_threaded - -(unittest) run -/unittest using - -% pairwise_bernoulli_on_target test -[1 2 4] -{ - ResetKernel - << /total_num_virtual_procs 4 >> SetKernelStatus - /layer_specs << /shape [ 4 4 ] /elements /iaf_psc_alpha /edge_wrap true >> def - /l1 layer_specs CreateLayer def - /l2 layer_specs CreateLayer def - - << /constant << /value 1.0 >> >> CreateParameter - << /constant << /value -0.02 >> >> CreateParameter - << /distance << >> >> CreateParameter - mul add /linear_parameter Set - - /conns << /connection_type (pairwise_bernoulli_on_target) - /mask << /circular << /radius 0.25 >> /anchor [ 0.0 0.0 ] >> - /weight linear_parameter - >> def - l1 l2 conns ConnectLayers - - /ofile tmpnam (_) join Rank 1 add cvs join (_of_) join NumProcesses cvs join def - ofile (w) file - l1 DumpLayerNodes - l2 DumpLayerNodes - l1 l2 /static_synapse DumpLayerConnections close - ofile -} -{ - /result_files Set - result_files == - - % Use the first result as reference - /ref [] def - result_files First 0 get dup /ref_filename Set (r) file - { - getline not - {exit} if % exit loop if EOF - ref exch append - /ref Set - } loop - close - (Num elements: ) ref length_a cvs join = - - % Compare the reference to the other results - /other_results [] def - result_files Rest - { - /result [] def - /n_elements 0 def - { - dup /filename Set - (r) file - { - getline - not {exit} if % exit loop if EOF - dup ref exch MemberQ dup /invariant Set - not {cvs ( not in ref ) join ref_filename join = exit} if % break out of loop if element not in reference - result exch append - /result Set - /n_elements n_elements 1 add def - } loop - close - invariant not {exit} if - } forall - n_elements ref length_a eq not - {/invariant false def (Lengths not equal, ) n_elements cvs join ( and ) join ref length_a cvs join = } if - invariant not {exit} if - /other_results other_results result append def - } forall - - invariant % true if all runs produce the same elements - -} distributed_collect_assert_or_die diff --git a/testsuite/pytests/sli2py_mpi/test_spatial_connections.py b/testsuite/pytests/sli2py_mpi/test_spatial_connections.py new file mode 100644 index 0000000000..e9af97e059 --- /dev/null +++ b/testsuite/pytests/sli2py_mpi/test_spatial_connections.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +# +# test_spatial_connections.py +# +# 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 . + +import pytest +from mpi_test_wrapper import MPITestAssertEqual + +""" +Confirm that spatial connections are created consistently for fixed VP. + +This test is parameterized at three levels: +- Neuron and generator as source +- Free and grid layers +- Different spatial connection rules + +Connections to recorders are handled in a separate test, as they only work with +the pairwise-bernoulli-on-source connection rule. +""" + + +# We cannot use nest or numpy outside the test function itself, so we need to create +# the free positions with basic Python commands. +@pytest.mark.skipif_incompatible_mpi +@pytest.mark.skipif_missing_threads +@pytest.mark.parametrize("source_model", ["poisson_generator", "parrot_neuron"]) +@pytest.mark.parametrize( + "geometry", + [ + ("free", {"pos": [(x, y) for x in range(-2, 3) for y in range(-2, 3)], "extent": [6, 6], "edge_wrap": True}), + ("grid", {"shape": [5, 5], "extent": [6, 6], "edge_wrap": True}), + ], +) +@pytest.mark.parametrize( + "conn_spec", + [ + {"rule": "fixed_indegree", "indegree": 10}, + {"rule": "fixed_outdegree", "outdegree": 10}, + {"rule": "pairwise_bernoulli", "p": 0.5, "use_on_source": False}, + {"rule": "pairwise_bernoulli", "p": 0.5, "use_on_source": True}, + ], +) +@MPITestAssertEqual([1, 2, 4], debug=False) +def test_spatial_connections(source_model, geometry, conn_spec): + """ + Confirm that spatial connections are created consistently for fixed VP. + + The test is performed on connection data written to OTHER_LABEL. + """ + + import nest + import numpy as np + import pandas as pd + + nest.ResetKernel() + nest.total_num_virtual_procs = 4 + + kind, specs = geometry + if kind == "free": + pos = nest.spatial.free(**specs) + else: + assert kind == "grid" + pos = nest.spatial.grid(**specs) + source_layer = nest.Create(source_model, positions=pos) + target_layer = nest.Create("parrot_neuron", positions=pos) + + nest.Connect( + source_layer, + target_layer, + {**conn_spec, "mask": {"circular": {"radius": 2.5}}}, + { + "weight": nest.spatial_distributions.gaussian(10 * nest.spatial.distance, std=2), + "delay": 0.1 + 0.2 * nest.spatial.distance, + }, + ) + + conns = nest.GetConnections() + df = pd.DataFrame.from_dict(conns.get(["source", "target", "weight", "delay"])) + df.to_csv(OTHER_LABEL.format(nest.num_processes, nest.Rank()), index=False, sep="\t") # noqa: F821 diff --git a/testsuite/pytests/sli2py_mpi/test_spatial_connections_to_generator.py b/testsuite/pytests/sli2py_mpi/test_spatial_connections_to_generator.py new file mode 100644 index 0000000000..306ffb06e3 --- /dev/null +++ b/testsuite/pytests/sli2py_mpi/test_spatial_connections_to_generator.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +# test_spatial_connections_to_generator.py +# +# 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 . + +import pytest +from mpi_test_wrapper import MPITestAssertEqual + +""" +Confirm that spatial connections to a generator are created consistently for fixed VP. + +This test is parameterized over free and grid layers. Only pairwise-bernoulli-on-source +is suitable as probabilistic connection rule when connecting to a device. +""" + + +# We cannot use nest or numpy outside the test function itself, so we need to create +# the free positions with basic Python commands. +@pytest.mark.skipif_incompatible_mpi +@pytest.mark.skipif_missing_threads +@pytest.mark.parametrize( + "geometry", + [ + ("free", {"pos": [(x, y) for x in range(-2, 3) for y in range(-2, 3)], "extent": [6, 6], "edge_wrap": True}), + ("grid", {"shape": [5, 5], "extent": [6, 6], "edge_wrap": True}), + ], +) +@MPITestAssertEqual([1, 2, 4], debug=False) +def test_spatial_connections(geometry): + """ + Confirm that spatial connections are created consistently for fixed VP. + + The test is performed on connection data written to OTHER_LABEL. + """ + + import nest + import numpy as np + import pandas as pd + + nest.ResetKernel() + nest.total_num_virtual_procs = 4 + + kind, specs = geometry + if kind == "free": + pos = nest.spatial.free(**specs) + else: + assert kind == "grid" + pos = nest.spatial.grid(**specs) + source_layer = nest.Create("parrot_neuron", positions=pos) + target_layer = nest.Create("spike_recorder", positions=pos) + + nest.Connect( + source_layer, + target_layer, + {"rule": "pairwise_bernoulli", "p": 0.5, "use_on_source": True, "mask": {"circular": {"radius": 2.5}}}, + { + "weight": nest.spatial_distributions.gaussian(10 * nest.spatial.distance, std=2), + "delay": 0.1 + 0.2 * nest.spatial.distance, + }, + ) + + conns = nest.GetConnections() + df = pd.DataFrame.from_dict(conns.get(["source", "target", "weight", "delay"])) + df.to_csv(OTHER_LABEL.format(nest.num_processes, nest.Rank()), index=False, sep="\t") # noqa: F821