diff --git a/testsuite/mpitests/issue-600.sli b/testsuite/mpitests/issue-600.sli deleted file mode 100644 index 494ed8ea2d..0000000000 --- a/testsuite/mpitests/issue-600.sli +++ /dev/null @@ -1,101 +0,0 @@ -/* - * issue-600.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 . - * - */ - - -/** @BeginDocumentation - Name: testsuite::issue-600 - Checks that waveform relaxation works with MPI - - Synopsis: (issue-600) run -> - - - Description: - issue-600.sli ensures that the iterative solution scheme in NEST still works when - neurons that use waveform relaxation are only present on a subset of all available - MPI processes. The test is a slightly changed version of test_gap_junctions_mpi.sli. - - Author: Jan Hahne, Hans Ekkehard Plesser - SeeAlso: testsuite::test_gap_junctions_mpi, hh_psc_alpha_gap, gap_junction -*/ - -(unittest) run -/unittest using - -% The following test needs the model hh_psc_alpha_gap, so -% this test should only run if we have GSL -skip_if_not_threaded -skip_if_without_gsl - -/total_vps 4 def - -[1 2 4] -{ - 0.1 /h Set - - << - /total_num_virtual_procs total_vps - /resolution h - /use_wfr true - /wfr_tol 0.0001 - /wfr_interpolation_order 3 - /wfr_max_iterations 10 - /wfr_comm_interval 1.0 - >> SetKernelStatus - - /hh_psc_alpha_gap Create /neuron1 Set - /iaf_psc_alpha Create /neuron2 Set - /hh_psc_alpha_gap Create /neuron3 Set - /iaf_psc_alpha Create /neuron4 Set - - neuron1 - << - /I_e 400. - >> SetStatus - - /sr /spike_recorder Create def - - neuron1 neuron3 - << /rule /one_to_one /make_symmetric true >> - << /synapse_model /gap_junction /weight 10.0 >> - Connect - - neuron1 neuron2 - << /rule /one_to_one >> - << /synapse_model /static_synapse /weight 8.0 >> - Connect - - neuron1 neuron4 - << /rule /one_to_one >> - << /synapse_model /static_synapse /weight 12.0 >> - Connect - - neuron1 sr Connect - neuron2 sr Connect - neuron3 sr Connect - neuron4 sr Connect - - 50 Simulate - - % get events, replace vectors with SLI arrays - /ev sr /events get def - ev keys { /k Set ev dup k get cva k exch put } forall - ev - -} distributed_process_invariant_events_assert_or_die diff --git a/testsuite/pytests/sli2py_mpi/test_issue_600.py b/testsuite/pytests/sli2py_mpi/test_issue_600.py new file mode 100644 index 0000000000..7d406b5a5a --- /dev/null +++ b/testsuite/pytests/sli2py_mpi/test_issue_600.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# +# test_issue_600.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 . + + +from mpi_test_wrapper import MPITestAssertEqual + + +@MPITestAssertEqual([1, 2, 4], debug=False) +def test_issue_600(): + """ + Confirm that waveform relaxation works with MPI. + """ + + import nest + import pandas as pd + + # We can only test here if GSL is available + if not nest.ll_api.sli_func("statusdict/have_gsl ::"): + return + + total_vps = 4 + h = 0.1 + + nest.SetKernelStatus( + { + "total_num_virtual_procs": total_vps, + "resolution": h, + "use_wfr": True, + "wfr_tol": 0.0001, + "wfr_interpolation_order": 3, + "wfr_max_iterations": 10, + "wfr_comm_interval": 1.0, + } + ) + n1 = nest.Create("hh_psc_alpha_gap", params={"I_e": 400.0}) + n2 = nest.Create("iaf_psc_alpha") + n3 = nest.Create("hh_psc_alpha_gap") + n4 = nest.Create("iaf_psc_alpha") + + sr = nest.Create( + "spike_recorder", + params={ + "record_to": "ascii", + "time_in_steps": True, + "label": SPIKE_LABEL.format(nest.num_processes), # noqa: F821 + }, + ) + + # Use weights as required or sufficient to trigger spikes in n3, n2, n4 + nest.Connect( + n1, n3, {"rule": "one_to_one", "make_symmetric": True}, {"synapse_model": "gap_junction", "weight": 10.0} + ) + nest.Connect(n1, n2, {"rule": "one_to_one"}, {"synapse_model": "static_synapse", "weight": 1000.0}) + nest.Connect(n1, n4, {"rule": "one_to_one"}, {"synapse_model": "static_synapse", "weight": 1200.0}) + + nest.Connect(n1 + n2 + n3 + n4, sr) + + nest.Simulate(50)