Skip to content

Commit 253b2b6

Browse files
authored
Merge pull request #3436 from heplesser/sli2py_281
Port mpitests/issue-281.sli to Python
2 parents 67a39da + c601e1f commit 253b2b6

File tree

4 files changed

+58
-67
lines changed

4 files changed

+58
-67
lines changed

testsuite/mpitests/issue-281.sli

-63
This file was deleted.

testsuite/pytests/sli2py_mpi/mpi_test_wrapper.py

+11
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,14 @@ def assert_correct_results(self, tmpdirpath):
275275

276276
for r in res[1:]:
277277
pd.testing.assert_frame_equal(res[0], r)
278+
279+
280+
class MPITestAssertCompletes(MPITestWrapper):
281+
"""
282+
Test class that just confirms that the test code completes.
283+
284+
Therefore, no testing to be done on any results.
285+
"""
286+
287+
def assert_correct_results(self, tmpdirpath):
288+
pass

testsuite/pytests/sli2py_mpi/test_issue_2119.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# You should have received a copy of the GNU General Public License
2020
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
2121

22-
23-
import pandas as pd
2422
import pytest
2523
from mpi_test_wrapper import MPITestAssertEqual
2624

@@ -50,5 +48,5 @@ def test_issue_2119(kind, specs):
5048
nrn = nest.Create("iaf_psc_alpha", n=4, params={"V_m": nest.CreateParameter(kind, specs)})
5149

5250
pd.DataFrame.from_dict(nrn.get(["global_id", "V_m"])).dropna().to_csv(
53-
OTHER_LABEL.format(nest.num_processes, nest.Rank()), index=False
54-
) # noqa: F821
51+
OTHER_LABEL.format(nest.num_processes, nest.Rank()), index=False # noqa: F821
52+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# test_issue_281.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 MPITestAssertCompletes
24+
25+
26+
@MPITestAssertCompletes([1, 2, 4])
27+
def test_issue_281():
28+
"""
29+
Confirm that ConnectLayers works MPI-parallel for fixed fan-out.
30+
"""
31+
32+
import nest
33+
import pandas as pd
34+
35+
layer = nest.Create("parrot_neuron", positions=nest.spatial.grid(shape=[3, 3]))
36+
nest.Connect(
37+
layer,
38+
layer,
39+
{"rule": "fixed_indegree", "indegree": 8, "allow_multapses": False, "allow_autapses": False},
40+
# weights are randomized to check that global RNGs stay in sync
41+
{"weight": nest.random.uniform(min=1, max=2)},
42+
)
43+
44+
# Ensure by simulation that global RNGs are still in sync
45+
nest.Simulate(10)

0 commit comments

Comments
 (0)