Skip to content

Commit

Permalink
Merge branch 'master' into header-hygiene-cabcode
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Aug 29, 2024
2 parents 5bbb3e2 + b985a12 commit 81453ef
Show file tree
Hide file tree
Showing 49 changed files with 647 additions and 823 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
run: |
python3 -m venv music-venv
source music-venv/bin/activate
python3 -m pip install mpi4py "cython<3" 'numpy<2' setuptools
python3 -m pip install 'mpi4py<4' cython numpy setuptools
sudo mkdir -p $MUSIC_INSTALL_DIR
sudo chown -R $USER $MUSIC_INSTALL_DIR
curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/neuron-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
# TODO: address-leak is the dream, but there are many problems,
# including external ones from the MPI implementations
sanitizer: address
- os: ubuntu-22.04
- os: ubuntu-24.04
config:
build_mode: cmake
# Cannot use a non-instrumented OpenMP with TSan, and we don't
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
run: |
sudo apt-get install build-essential ccache libopenmpi-dev \
libmpich-dev libx11-dev libxcomposite-dev mpich ninja-build \
openmpi-bin flex libfl-dev bison
openmpi-bin flex libfl-dev bison libreadline-dev
# The sanitizer builds use ubuntu 22.04
if [[ "${{matrix.os}}" == "ubuntu-20.04" ]]; then
sudo apt-get install g++-7 g++-8
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
run: |
python3 -m venv music-venv
source music-venv/bin/activate
python3 -m pip install mpi4py "cython<3" 'numpy<2' setuptools
python3 -m pip install 'mpi4py<4' cython numpy setuptools
sudo mkdir -p $MUSIC_INSTALL_DIR
sudo chown -R $USER $MUSIC_INSTALL_DIR
curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip
Expand Down
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ if(NRN_ENABLE_RX3D)
message(SEND_ERROR "NRN_ENABLE_RX3D requires NRN_ENABLE_PYTHON feature.")
else()
find_package(Cython REQUIRED)
if(CYTHON_VERSION VERSION_GREATER_EQUAL 3)
message(FATAL_ERROR "Cython 3+ is not supported")
endif()
endif()
endif()
if(MINGW)
Expand Down Expand Up @@ -382,9 +379,6 @@ if(NRN_ENABLE_MUSIC)
message(FATAL "MUSIC requires -DNRN_ENABLE_PYTHON=ON")
endif()
find_package(Cython REQUIRED)
if(CYTHON_VERSION VERSION_GREATER_EQUAL 3)
message(FATAL_ERROR "Cython 3+ is not supported")
endif()
find_package(MUSIC REQUIRED)
set(NRN_MUSIC 1)
endif()
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ stages:
export PATH=/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export NRN_BUILD_FOR_UPLOAD=1
sudo mkdir /opt/nrnwheel
sudo tar -zxf $(readlineSF.secureFilePath) --directory /opt/nrnwheel/
sudo mkdir -p /opt/nrnwheel/$(uname -m)
sudo tar -zxf $(readlineSF.secureFilePath) --directory /opt/nrnwheel/$(uname -m)
packaging/python/build_wheels.bash osx $(python.version) coreneuron
displayName: 'Build MacOS Wheel'
Expand Down
13 changes: 12 additions & 1 deletion bin/nrnivmodl.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,19 @@ while [ "$1" ] ; do
UserNMODLFLAGS="$UserNMODLFLAGS $2"
shift
shift;;
-h|--help)
echo "Usage: nrnivmodl [options] [mod files or directories with mod files]"
echo "Options:"
echo " -coreneuron Compile MOD files for CoreNEURON using nrnivmodl-core."
echo " -incflags \"include flags\" Extra include flags and paths when MOD (C++) files are compiled."
echo " -loadflags \"link flags\" Extra link flags, paths, and libraries when MOD (C++) files are linked."
echo " -nmodl /path/to/nmodl Path to the new NMODL transpiler for MOD files (pre-alpha, development use only)."
echo " -nmodlflags \"CLI flags\" Additional CLI flags for new NMODL transpiler"
echo " -h, --help Show this help message and exit."
echo "If no MOD files or directories provided then MOD files from current directory are used."
exit 0;;
-*)
echo "$1 unrecognized"
echo "$1 unrecognized, check available CLI options with --help"
exit 1;;
*)
break;;
Expand Down
4 changes: 2 additions & 2 deletions ci/win_build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export MSYSTEM_PREFIX=/mingw64
export PATH=/mingw64/bin:$PATH

# have compatible cython3
python3 -m pip install "cython<3"
python3 -m pip install "cython"

# if BUILD_SOURCESDIRECTORY not available, use te root of the repo
if [ -z "$BUILD_SOURCESDIRECTORY" ]; then
Expand All @@ -30,7 +30,7 @@ cd $BUILD_SOURCESDIRECTORY/build
-DNRN_ENABLE_RX3D=ON \
-DNRN_RX3D_OPT_LEVEL=2 \
-DNRN_BINARY_DIST_BUILD=ON \
-DPYTHON_EXECUTABLE=/c/Python38/python.exe \
-DPYTHON_EXECUTABLE=/c/Python39/python.exe \
-DNRN_ENABLE_PYTHON_DYNAMIC=ON \
-DNRN_PYTHON_DYNAMIC='c:/Python38/python.exe;c:/Python39/python.exe;c:/Python310/python.exe;c:/Python311/python.exe;c:/Python312/python.exe' \
-DCMAKE_INSTALL_PREFIX='/c/nrn-install' \
Expand Down
10 changes: 5 additions & 5 deletions ci/win_install_deps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ pwsh -command "(Get-Content C:\Python310\Lib\distutils\cygwinccompiler.py) -repl
pwsh -command "(Get-Content C:\Python311\Lib\distutils\cygwinccompiler.py) -replace 'msvcr100', 'msvcrt' | Out-File C:\Python311\Lib\distutils\cygwinccompiler.py"

:: install numpy
C:\Python38\python.exe -m pip install numpy==1.17.5 "cython < 3" || goto :error
C:\Python39\python.exe -m pip install numpy==1.19.3 "cython < 3" || goto :error
C:\Python310\python.exe -m pip install numpy==1.21.3 "cython < 3" || goto :error
C:\Python311\python.exe -m pip install numpy==1.23.5 "cython < 3" || goto :error
C:\Python312\python.exe -m pip install numpy==1.26.3 "cython < 3" || goto :error
C:\Python38\python.exe -m pip install numpy cython || goto :error
C:\Python39\python.exe -m pip install numpy cython || goto :error
C:\Python310\python.exe -m pip install numpy cython || goto :error
C:\Python311\python.exe -m pip install numpy cython || goto :error
C:\Python312\python.exe -m pip install numpy cython || goto :error
:: setuptools 70.2 leads to an error
C:\Python312\python.exe -m pip install setuptools==70.1.1 || goto :error

Expand Down
19 changes: 17 additions & 2 deletions ci/win_test_installer.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,24 @@ C:\Python38\python -c "import neuron; neuron.test(); quit()" || set "errorfound=
C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python310\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python311\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
:: install numpy dependency
python -m pip install "numpy<2"
C:\Python312\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"

:: install oldest supported numpy
C:\Python38\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error
C:\Python39\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error
C:\Python310\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error
C:\Python311\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error
C:\Python312\python.exe -m pip install -r packaging/python/oldest_numpy_requirements.txt || goto :error

:: test all pythons again
C:\Python38\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python39\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python310\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python311\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"
C:\Python312\python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"

:: run also using whatever is system python
python -m pip install numpy
python --version
python -c "import neuron; neuron.test(); quit()" || set "errorfound=y"

Expand Down
6 changes: 5 additions & 1 deletion cmake/ExternalProjectHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ function(nrn_initialize_submodule path)
list(APPEND UPDATE_OPTIONS --recursive)
endif()
if(opt_SHALLOW)
list(APPEND UPDATE_OPTIONS --depth 1)
# RHEL7-family distributions ship with an old git that does not support the --depth argument to
# git submodule update
if(GIT_VERSION_STRING VERSION_GREATER_EQUAL "1.8.4")
list(APPEND UPDATE_OPTIONS --depth 1)
endif()
endif()
if(NOT ${GIT_FOUND})
message(
Expand Down
1 change: 0 additions & 1 deletion cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ set(NRNOC_FILE_LIST
ldifus.cpp
membfunc.cpp
memblist.cpp
nrnnemo.cpp
nrntimeout.cpp
nrnversion.cpp
passive0.cpp
Expand Down
8 changes: 7 additions & 1 deletion cmake/coreneuron/MakefileBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ function(coreneuron_process_target target)
if(target_imported)
# In this case we can extract the full path to the library
get_target_property(target_location ${target} LOCATION)
coreneuron_process_library_path(${target_location})
if(target_location)
coreneuron_process_library_path(${target_location})
endif()
else()
# This is probably another of our libraries, like -lcoreneuron-cuda. We might need to add -L
# and an RPATH later.
set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_LIB_LINK_DEP_FLAGS " -l${target}")
endif()
endif()
get_target_property(target_flags ${target} INTERFACE_COMPILE_OPTIONS)
if(target_flags)
set_property(GLOBAL APPEND_STRING PROPERTY CORENRN_EXTRA_COMPILE_FLAGS " ${target_flags}")
endif()
get_target_property(target_libraries ${target} LINK_LIBRARIES)
if(target_libraries)
foreach(child_target ${target_libraries})
Expand Down
16 changes: 16 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# NEURON 8.2

## 8.2.6
_Release Date_ : 24-07-2024

This release pins numpy to <2 and includes backports for several fixes.

### Bug Fixes
- Informative error when cannot import hoc module
- ParallelContext: hoc_ac_ encodes global id of submitted process.
- Python 3.12 compatibility with Windows installer (#2963)
- Windows 11 fix for nrniv -python (#2946)
- Fix for dynamic ECS diffusion characteristics.
- python38 is back. For testing can use rx3doptlevel=0 bash bldnrnmacpkgcmake.sh
- Fix cvode.use_fast_imem(1) error with electrode time varying conductance.
- Apple M1 cmake failure in cloning subrepository. See #2326.
- Update iv

## 8.2.4
_Release Date_ : 08-02-2024

Expand Down
2 changes: 1 addition & 1 deletion docs/conda_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- cmake
- xorg-libxcomposite
- ffmpeg
- cython<3
- cython
- pandoc
- mpich
- pip
Expand Down
56 changes: 50 additions & 6 deletions docs/dev/setuptools/setuptools.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,64 @@ We use [setup.py](../../../setup.py) in two operational modes
:

1) **wheel building**
It boils down to
It boils down to

setup.py build_ext bdist_wheel

We configure the HOC extension along with a CMake configure, build all extensios and collect them for the wheel. This is called via [build_wheels.bash](../../../packaging/python/build_wheels.bash).

2) **CMake build**
It boils down to

setup.py build_ext build

We provide the cmake build folder, in this mode we do not run CMake configure, we build all extensions and make sure they are integrated into the CMake build and install. This is called via CMake in [src/nrnpython/CMakeLists.txt](../../../src/nrnpython/CMakeLists.txt) by passing **--cmake-build-dir** (the folder where we configured NEURON with CMake), along with other CMake options.
setup.py build_ext build

We provide the cmake build folder, in this mode we do not run CMake configure, we build all extensions and make sure they are integrated into the CMake build and install. This is called via CMake in [src/nrnpython/CMakeLists.txt](../../../src/nrnpython/CMakeLists.txt) by passing **--cmake-build-dir** (the folder where we configured NEURON with CMake), along with other CMake options.


## **Activity Diagram**

![](images/setup-py.png)
![](images/setup-py.png)


## Creating a Development Python Package

`setup.py` can be lanched manually as well to create a dev build package, which can be tested
immediately. It supports several arguments to that the build can be tuned:

```
--disable-rx3d Disables Rx3d. Implies CMake -DNRN_ENABLE_RX3D=OFF
--disable-iv Disables IV. Implies CMake -DNRN_ENABLE_INTERVIEWS=OFF
--disable-mpi Disables MPI. Implies -DNRN_ENABLE_MPI=OFF and disabling of neuronmusic
--enable-music Enables neuronmusic
--enable-coreneuron Enables experimental CorenNeuron support
--rx3d-opt-level Sets the rx3d optimization level. Default: 0 (-O0)
--cmake-build-dir Declares one wants to use a specic NEURON build (with CMake), instead
of creating one behind the scenes. Only builds extensions and package.
```

A quick build for testing a change to a core component could therefore be:
```
python setup.py build --disable-rx3d --disable-iv --disable-mpi
```

---
**Mac Note**

Since the introduction of Mac with Apple silicon, with an Official Python distribution, extension are simultaneously built for arm64 and x86_64. Besides not required for a dev build, it may fail
on older SDKs with `Unsupported architecture` errors.

To skip that you may set the ARCHFLAGS environment var. Set it to "" (empty) for default architecture: `ARCHFLAGS='' python setup.py ...`

---

### Testing

Once built, the package may be imported and used normally. You might, however, need to set up
PYTHONPATH accordingly for the import to work:

```
export PYTHONPATH="<NRNDIR>/build/lib.macosx-10.9-x86_64-3.9/:$PYTHONPATH"
# Run Neuron base tests
python -c "import neuron; neuron.test()"
```
2 changes: 1 addition & 1 deletion docs/guide/hoc_chapter_11_old_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ Names introduced by nrnoc
.. code::
c++
node_data disconnect batch_run batch_save
disconnect batch_run batch_save
pt3dclear pt3dadd n3d x3d y3d z3d diam3d arc3d
define_shape p3dconst spine3d setSpineArea getSpineArea
area ri initnrn topology fadvance distance
Expand Down
29 changes: 1 addition & 28 deletions docs/hoc/compilationoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Rarely Used Compilation Options

The following definitions are found in nrnoc/SRC/options.h and add extra
functionality which not everyone may need. The extras come at the cost
of larger memory requirements for node and section structures. METHOD3 is too large
and obscure to benefit most users.
of larger memory requirements for node and section structures.

.. code-block::
none
Expand All @@ -27,29 +26,3 @@ and obscure to benefit most users.
* of spine. setSpineArea() tells how much
* area/spine to add to the segment. */
#endif
#define METHOD3 1 /* third order spatially correct method */
/* testing only, not completely implemented */
/* not working at this time */
#if METHOD3
spatial_method(i)
no arg, returns current method
i=0 The standard NEURON method with zero area nodes at the ends
of sections.
i=1 conventional method with 1/2 area end nodes
i=2 modified second order method
i=3 third order correct spatial method
Note: i=1-3 don't work under all circumstances. They have been
insufficiently tested and the correctness must be established for
each simulation.
#endif
#if NEMO
neuron2nemo("filename") Beginning of translator between John Millers
nemosys program and NEURON. Probably out of date.
nemo2neuron("filename")
#endif
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Installation
pip3 install neuron
Alternatively, you can use the `PKG installer <https://github.com/neuronsimulator/nrn/releases/download/8.2.4/nrn-8.2.4-macosx-10.9-universal2-py-38-39-310-311.pkg>`_.
Alternatively, you can use the `PKG installer <https://github.com/neuronsimulator/nrn/releases/download/8.2.6/nrn-8.2.6-macosx-10.9-universal2-py-38-39-310-311-312.pkg>`_.

For troubleshooting, see the `detailed installation instructions <install/install_instructions.md>`_.

Expand All @@ -115,7 +115,7 @@ Installation

.. tab-item:: Windows

`Download the Windows Installer <https://github.com/neuronsimulator/nrn/releases/download/8.2.4/nrn-8.2.4.w64-mingw-py-37-38-39-310-311-setup.exe>`_.
`Download the Windows Installer <https://github.com/neuronsimulator/nrn/releases/download/8.2.6/nrn-8.2.6.w64-mingw-py-38-39-310-311-312-setup.exe>`_.

You can also install the Linux wheel via the Windows Subsystem for Linux (WSL). See `instructions <install/install_instructions.html#windows-subsystem-for-linux-wsl-python-wheel>`_.

Expand Down
Loading

0 comments on commit 81453ef

Please sign in to comment.