|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# |
| 3 | +# test_issue_600.py |
| 4 | +# |
| 5 | +# This file is part of NEST. |
| 6 | +# |
| 7 | +# Copyright (C) 2004 The NEST Initiative |
| 8 | +# |
| 9 | +# NEST is free software: you can redistribute it and/or modify |
| 10 | +# it under the terms of the GNU General Public License as published by |
| 11 | +# the Free Software Foundation, either version 2 of the License, or |
| 12 | +# (at your option) any later version. |
| 13 | +# |
| 14 | +# NEST is distributed in the hope that it will be useful, |
| 15 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | +# GNU General Public License for more details. |
| 18 | +# |
| 19 | +# You should have received a copy of the GNU General Public License |
| 20 | +# along with NEST. If not, see <http://www.gnu.org/licenses/>. |
| 21 | + |
| 22 | + |
| 23 | +from mpi_test_wrapper import MPITestAssertEqual |
| 24 | + |
| 25 | + |
| 26 | +@MPITestAssertEqual([1, 2, 4], debug=False) |
| 27 | +def test_issue_600(): |
| 28 | + """ |
| 29 | + Confirm that waveform relaxation works with MPI. |
| 30 | + """ |
| 31 | + |
| 32 | + import nest |
| 33 | + import pandas as pd |
| 34 | + |
| 35 | + # We can only test here if GSL is available |
| 36 | + if not nest.ll_api.sli_func("statusdict/have_gsl ::"): |
| 37 | + return |
| 38 | + |
| 39 | + total_vps = 4 |
| 40 | + h = 0.1 |
| 41 | + |
| 42 | + nest.SetKernelStatus( |
| 43 | + { |
| 44 | + "total_num_virtual_procs": total_vps, |
| 45 | + "resolution": h, |
| 46 | + "use_wfr": True, |
| 47 | + "wfr_tol": 0.0001, |
| 48 | + "wfr_interpolation_order": 3, |
| 49 | + "wfr_max_iterations": 10, |
| 50 | + "wfr_comm_interval": 1.0, |
| 51 | + } |
| 52 | + ) |
| 53 | + n1 = nest.Create("hh_psc_alpha_gap", params={"I_e": 400.0}) |
| 54 | + n2 = nest.Create("iaf_psc_alpha") |
| 55 | + n3 = nest.Create("hh_psc_alpha_gap") |
| 56 | + n4 = nest.Create("iaf_psc_alpha") |
| 57 | + |
| 58 | + sr = nest.Create( |
| 59 | + "spike_recorder", |
| 60 | + params={ |
| 61 | + "record_to": "ascii", |
| 62 | + "time_in_steps": True, |
| 63 | + "label": SPIKE_LABEL.format(nest.num_processes), # noqa: F821 |
| 64 | + }, |
| 65 | + ) |
| 66 | + |
| 67 | + # Use weights as required or sufficient to trigger spikes in n3, n2, n4 |
| 68 | + nest.Connect( |
| 69 | + n1, n3, {"rule": "one_to_one", "make_symmetric": True}, {"synapse_model": "gap_junction", "weight": 10.0} |
| 70 | + ) |
| 71 | + nest.Connect(n1, n2, {"rule": "one_to_one"}, {"synapse_model": "static_synapse", "weight": 1000.0}) |
| 72 | + nest.Connect(n1, n4, {"rule": "one_to_one"}, {"synapse_model": "static_synapse", "weight": 1200.0}) |
| 73 | + |
| 74 | + nest.Connect(n1 + n2 + n3 + n4, sr) |
| 75 | + |
| 76 | + nest.Simulate(50) |
0 commit comments