Skip to content

Commit

Permalink
Merge branch 'master' into prototype/connection_semantics
Browse files Browse the repository at this point in the history
# Conflicts:
#	pynest/examples/aeif_cond_beta_multisynapse.py
#	pynest/nest/__init__.py
#	pynest/nest/lib/hl_api_models.py
#	testsuite/pytests/test_compartmental_model.py
#	testsuite/pytests/test_spatial/test_SynapseCollection_distance.py
#	testsuite/pytests/test_urbanczik_synapse.py
  • Loading branch information
otcathatsya committed Oct 11, 2023
2 parents 5555049 + e976007 commit c9726cd
Show file tree
Hide file tree
Showing 311 changed files with 1,002 additions and 661 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/nestbuildmatrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ jobs:
- name: "Run pylint..."
run: |
pylint --jobs=$(nproc) pynest/ testsuite/pytests/*.py testsuite/regressiontests/*.py
isort:
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout repository content"
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Run isort..."
uses: isort/isort-action@f14e57e1d457956c45a19c05a89cccdf087846e5 # 1.1.0
with:
configuration: --profile=black --thirdparty="nest" --check-only --diff

black:
runs-on: "ubuntu-20.04"
Expand All @@ -298,8 +311,9 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Run black..."
uses: psf/black@bf7a16254ec96b084a6caf3d435ec18f0f245cc7 # 23.3.0
uses: psf/black@193ee766ca496871f93621d6b58d57a6564ff81b # 23.7.0
with:
jupyter: true

Expand Down Expand Up @@ -405,7 +419,7 @@ jobs:
build_linux:
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
runs-on: ${{ matrix.os }}
needs: [clang-format, mypy, copyright_headers, unused_names, forbidden_types, pylint, black, flake8]
needs: [clang-format, mypy, copyright_headers, unused_names, forbidden_types, pylint, isort, black, flake8]
env:
CXX_FLAGS: "-pedantic -Wextra -Woverloaded-virtual -Wno-unknown-pragmas"
NEST_VPATH: "build"
Expand Down Expand Up @@ -607,7 +621,7 @@ jobs:
build_macos:
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
runs-on: ${{ matrix.os }}
needs: [clang-format, mypy, copyright_headers, unused_names, forbidden_types, pylint, black, flake8]
needs: [clang-format, mypy, copyright_headers, unused_names, forbidden_types, pylint, isort, black, flake8]
env:
CXX_FLAGS: "-pedantic -Wextra -Woverloaded-virtual -Wno-unknown-pragmas"
NEST_VPATH: "build"
Expand Down
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", "--thirdparty", "nest", "--diff"]
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.0-post0.dev0
3.6.0-post0.dev0
2 changes: 1 addition & 1 deletion bin/nest-server
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ start() {
if [ "${DAEMON}" -eq 0 ]; then
echo "Use CTRL + C to stop this service."
if [ "${STDOUT}" -eq 1 ]; then
echo "-------------------------------------------------"
echo "-----------------------------------------------------"
fi
fi

Expand Down
24 changes: 11 additions & 13 deletions bin/nest-server-mpi
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ Options:
from docopt import docopt
from mpi4py import MPI

if __name__ == '__main__':
if __name__ == "__main__":
opt = docopt(__doc__)

import time
import os
import sys
import time

import nest
import nest.server

import os

HOST = os.getenv("NEST_SERVER_HOST", "127.0.0.1")
PORT = os.getenv("NEST_SERVER_PORT", "52425")

Expand All @@ -35,34 +34,33 @@ rank = comm.Get_rank()


def log(call_name, msg):
msg = f'==> WORKER {rank}/{time.time():.7f} ({call_name}): {msg}'
msg = f"==> WORKER {rank}/{time.time():.7f} ({call_name}): {msg}"
print(msg, flush=True)


if rank == 0:
print("==> Starting NEST Server Master on rank 0", flush=True)
nest.server.set_mpi_comm(comm)
nest.server.run_mpi_app(host=opt.get('--host', HOST), port=opt.get('--port', PORT))
nest.server.run_mpi_app(host=opt.get("--host", HOST), port=opt.get("--port", PORT))

else:
print(f"==> Starting NEST Server Worker on rank {rank}", flush=True)
nest.server.set_mpi_comm(comm)
while True:

log('spinwait', 'waiting for call bcast')
log("spinwait", "waiting for call bcast")
call_name = comm.bcast(None, root=0)

log(call_name, 'received call bcast, waiting for data bcast')
log(call_name, "received call bcast, waiting for data bcast")
data = comm.bcast(None, root=0)

log(call_name, f'received data bcast, data={data}')
log(call_name, f"received data bcast, data={data}")
args, kwargs = data

if call_name == 'exec':
if call_name == "exec":
response = nest.server.do_exec(args, kwargs)
else:
call, args, kwargs = nest.server.nestify(call_name, args, kwargs)
log(call_name, f'local call, args={args}, kwargs={kwargs}')
log(call_name, f"local call, args={args}, kwargs={kwargs}")

# The following exception handler is useful if an error
# occurs simulataneously on all processes. If only a
Expand All @@ -74,5 +72,5 @@ else:
except Exception:
continue

log(call_name, f'sending reponse gather, data={response}')
log(call_name, f"sending reponse gather, data={response}")
comm.gather(nest.serializable(response), root=0)
2 changes: 1 addition & 1 deletion build_support/check_copyright_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@


import os
import sys
import re
import sys


def eprint(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion build_support/check_unused_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"""

import os
import sys
import re
import sys
from subprocess import check_output


Expand Down
9 changes: 7 additions & 2 deletions build_support/format_all_c_c++_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

# With this script you can easily format all C/C++ files contained in
# any (sub)directory of NEST. Internally it uses clang-format to do
# the actual formatting. You can give a different clang-format command,
# e.g. by executing `CLANG_FORMAT=clang-format-14 ./format_all_c_c++_files.sh`.
# the actual formatting.
#
# NEST C/C++ code should be formatted according to clang-format version 13.0.0.
# If you would like to see how the code will be formatted with a different
# clang-format version, execute e.g. `CLANG_FORMAT=clang-format-14 ./format_all_c_c++_files.sh`.
#
# By default the script starts at the current working directory ($PWD), but
# supply a different starting directory as the first argument to the command.

CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
CLANG_FORMAT_FILE=${CLANG_FORMAT_FILE:-.clang-format}

Expand Down
3 changes: 1 addition & 2 deletions build_support/generate_modelsmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
compiled by CMake.
"""

import argparse
import os
import sys
import argparse

from pathlib import Path
from textwrap import dedent

Expand Down
3 changes: 2 additions & 1 deletion doc/htmldoc/_ext/HoverXTooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import re
import os
import re
import sys

from docutils import nodes
from docutils.parsers.rst import Directive, directives

Expand Down
1 change: 1 addition & 0 deletions doc/htmldoc/_ext/VersionSyncRole.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import json
from pathlib import Path

from docutils import nodes


Expand Down
3 changes: 2 additions & 1 deletion doc/htmldoc/_ext/add_button_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import glob
import os
import sys
from sphinx.application import Sphinx
from pathlib import Path

from sphinx.application import Sphinx


def add_button_to_examples(app, env, docnames):
"""Find all examples and include a link to launch notebook.
Expand Down
36 changes: 27 additions & 9 deletions doc/htmldoc/_ext/extract_api_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
import os
import ast
import json
import re
import glob
import os
import re

from sphinx.application import Sphinx

"""
Generate a JSON dictionary that stores the module name as key and corresponding
Expand Down Expand Up @@ -106,13 +106,31 @@ def process_directory(directory):
return api_dict


def ExtractPyNESTAPIS():
def get_pynest_list(app, env, docname):
directory = "../../pynest/nest/"
all_variables_dict = process_directory(directory)

with open("api_function_list.json", "w") as outfile:
json.dump(all_variables_dict, outfile, indent=4)
if not hasattr(env, "pynest_dict"):
env.pynest_dict = {}

env.pynest_dict = process_directory(directory)


def api_customizer(app, docname, source):
env = app.builder.env
if docname == "ref_material/pynest_api/index":
get_apis = env.pynest_dict
html_context = {"api_dict": get_apis}
api_source = source[0]
rendered = app.builder.templates.render_string(api_source, html_context)
source[0] = rendered


def setup(app):
app.connect("env-before-read-docs", get_pynest_list)
app.connect("source-read", api_customizer)

if __name__ == "__main__":
ExtractPyNESTAPIS()
return {
"version": "0.1",
"parallel_read_safe": True,
"parallel_write_safe": True,
}
13 changes: 6 additions & 7 deletions doc/htmldoc/_ext/extractor_userdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import re
from tqdm import tqdm
from pprint import pformat
from math import comb

import os
import glob
import json
from itertools import chain, combinations
import logging
import os
import re
from collections import Counter
from itertools import chain, combinations
from math import comb
from pprint import pformat

from tqdm import tqdm

logging.basicConfig(level=logging.WARNING)
log = logging.getLogger(__name__)
Expand Down
9 changes: 4 additions & 5 deletions doc/htmldoc/_ext/list_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import glob
import logging
import os

from docutils import nodes
from docutils.parsers.rst import Directive, Parser

from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective
import os
import glob

import logging

logging.basicConfig(level=logging.WARNING)
log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion doc/htmldoc/clean_source_dirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import pathlib
import shutil
from glob import glob

for dir_ in ("auto_examples", "models"):
Expand Down
Loading

0 comments on commit c9726cd

Please sign in to comment.