Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed May 8, 2024
2 parents 34bedc0 + 4a1e15a commit dfd4813
Show file tree
Hide file tree
Showing 222 changed files with 4,321 additions and 4,791 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
env:
PY_MIN_VERSION: '3.8'
PY_MID_VERSION: '3.10'
PY_MAX_VERSION: '3.11'
PY_MAX_VERSION: '3.12'

jobs:
coverage:
Expand Down 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
python3 -m pip install mpi4py "cython<3" 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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
- release/**

env:
DEFAULT_PY_VERSION: '3.11'
DEFAULT_PY_VERSION: '3.12'

jobs:
documentation:
Expand Down
44 changes: 32 additions & 12 deletions .github/workflows/neuron-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
DESIRED_CMAKE_VERSION: 3.17
DYNAMIC_PYTHON_CMAKE_VERSION: 3.18
PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.8' }}
PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.11' }}
PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.12' }}
MUSIC_INSTALL_DIR: /opt/MUSIC
MUSIC_VERSION: 1.2.1

Expand All @@ -49,7 +49,7 @@ jobs:
config:
- { matrix_eval : "CC=gcc-9 CXX=g++-9", build_mode: "setuptools"}
- { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", music: ON}
- { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", python_dynamic: ON}
- { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", python_dynamic: ON}
- { matrix_eval : "CC=gcc-9 CXX=g++-9" , build_mode: "cmake", cmake_option: "-DNRN_ENABLE_CORENEURON=ON"}
- { matrix_eval : "CC=gcc-9 CXX=g++-9", build_mode: "cmake", cmake_option: "-DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_CORENEURON=ON"}
- { matrix_eval : "CC=gcc-10 CXX=g++-10", build_mode: "cmake", cmake_option: "-DNRN_ENABLE_PYTHON=OFF -DNRN_ENABLE_RX3D=OFF -DNRN_ENABLE_CORENEURON=ON"}
Expand Down Expand Up @@ -108,15 +108,20 @@ jobs:
# Unlink and re-link to prevent errors when GitHub macOS runner images
# install Python outside of brew; See actions/setup-python#577 and BlueBrain/libsonata/pull/317
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
brew install ccache coreutils doxygen flex bison mpich ninja xz autoconf autoconf automake libtool
brew install ccache coreutils doxygen flex bison mpich ninja xz autoconf automake libtool
# We use both for dynamic mpi in nrn
brew unlink mpich
brew install openmpi
brew install --cask xquartz
echo /usr/local/opt/flex/bin:/usr/local/opt/bison/bin >> $GITHUB_PATH
# Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
echo CMAKE_BUILD_PARALLEL_LEVEL=3 >> $GITHUB_ENV
echo CTEST_PARALLEL_LEVEL=3 >> $GITHUB_ENV
echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH
# Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
if [[ "${{matrix.os}}" == "macOS-13" ]]; then
echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV
echo CTEST_PARALLEL_LEVEL=4 >> $GITHUB_ENV
else
echo CMAKE_BUILD_PARALLEL_LEVEL=3 >> $GITHUB_ENV
echo CTEST_PARALLEL_LEVEL=3 >> $GITHUB_ENV
fi
echo CI_OS_NAME=osx >> $GITHUB_ENV
shell: bash

Expand All @@ -130,9 +135,9 @@ jobs:
if [[ "${{matrix.os}}" == "ubuntu-20.04" ]]; then
sudo apt-get install g++-7 g++-8
fi
# Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
echo CMAKE_BUILD_PARALLEL_LEVEL=2 >> $GITHUB_ENV
echo CTEST_PARALLEL_LEVEL=2 >> $GITHUB_ENV
# Core https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
echo CMAKE_BUILD_PARALLEL_LEVEL=4 >> $GITHUB_ENV
echo CTEST_PARALLEL_LEVEL=4 >> $GITHUB_ENV
echo CI_OS_NAME=linux >> $GITHUB_ENV
shell: bash

Expand Down Expand Up @@ -171,12 +176,27 @@ jobs:
python -m pip install --upgrade -r external/nmodl/requirements.txt
python -m pip install --upgrade -r ci_requirements.txt
- name: Install a new automake
# A new automake is needed for python 3.12 because it generate a python script
# called py-compile and the original one is not supporting this version of python
# Once ubuntu got a newer version of automake we can remove this part.
if: matrix.config.music == 'ON' && startsWith(matrix.os, 'ubuntu')
run: |
curl -L -o automake.tar.xz https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.xz
tar -xf automake.tar.xz
cd automake-1.16.5/
./configure --prefix=/usr/
make -j
sudo make -j install
automake --version
working-directory: ${{runner.temp}}

- name: Setup MUSIC@${{ env.MUSIC_VERSION }}
if: matrix.config.music == 'ON'
run: |
python3 -m venv music-venv
source music-venv/bin/activate
python3 -m pip install mpi4py "cython<3" numpy
python3 -m pip install mpi4py "cython<3" 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 Expand Up @@ -273,7 +293,7 @@ jobs:
else
CC=$(command -v clang-14)
CXX=$(command -v clang++-14)
symbolizer_path=$(realpath $(command -v llvm-symbolizer-14))
symbolizer_path="$(readlink -f "$(command -v llvm-symbolizer-14)")"
cmake_args+=(-DLLVM_SYMBOLIZER_PATH="${symbolizer_path}")
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Set up Python3
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Download Dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ simulation_stack:
variables:
bb5_ntasks: 2 # so we block 16 cores
bb5_cpus_per_task: 8 # ninja -j {this}
bb5_memory: 120G # ~1.5*16*384/80 (~1.5x more as we have seen OOMs)
bb5_memory: 160G # ~2*16*384/80 (~2x more as we have seen OOMs)

.spack_intel:
variables:
Expand All @@ -192,7 +192,7 @@ simulation_stack:
extends: [.ctest]
variables:
bb5_ntasks: 16
bb5_memory: 120G # ~1.5*16*384/80 (~1.5x more as we have seen OOMs)
bb5_memory: 160G # ~2*16*384/80 (~2x more as we have seen OOMs)

# Build NMODL once with GCC
build:nmodl:
Expand Down
1 change: 1 addition & 0 deletions .sanitizers/undefined.supp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ shift-base:nrnRan4int
unsigned-integer-overflow:_philox4x32bumpkey(r123array2x32)
unsigned-integer-overflow:coreneuron::nrnran123_deletestream(coreneuron::nrnran123_State*, bool)
unsigned-integer-overflow:coreneuron::nrnran123_newstream3(unsigned int, unsigned int, unsigned int, bool)
unsigned-integer-overflow:Py_INCREF(_object*)
vptr:NetCon::disconnect(ivObservable*)
vptr:ObjObservable::object()
vptr:PreSyn::disconnect(ivObservable*)
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ if(NRN_ENABLE_THREADS)
list(APPEND NRN_COMPILE_DEFS NRN_ENABLE_THREADS)
endif()

# Some files are shared by NEURON and CoreNEURON and use #if CORENRN_BUILD to distinguish between
# which build is occurring.
list(APPEND NRN_COMPILE_DEFS CORENRN_BUILD=0)

# =============================================================================
# Profiler/Instrumentation Options
# =============================================================================
Expand Down Expand Up @@ -732,7 +736,7 @@ add_custom_target(
# =============================================================================
# ~~~
# Update hh.mod for CoreNEURON compatibility
# - Replace GLOBAL variable by RANHE
# - Replace GLOBAL variable by RANGE
# - Comment out TABLE
# ~~~
# =============================================================================
Expand Down Expand Up @@ -829,10 +833,12 @@ if(NRN_ENABLE_TESTS)
set(neurondemo_files
"${neurondemo_prefix}/special"
"${neurondemo_prefix}/${CMAKE_SHARED_LIBRARY_PREFIX}nrnmech${CMAKE_SHARED_LIBRARY_SUFFIX}")

add_custom_command(
OUTPUT ${neurondemo_files}
COMMAND ${CMAKE_COMMAND} -E env ${NRN_RUN_FROM_BUILD_DIR_ENV}
${NRN_SANITIZER_ENABLE_ENVIRONMENT} "${PROJECT_BINARY_DIR}/bin/nrnivmodl"
DEPENDS nrnivmodl_dependency
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/share/nrn/demo/release
VERBATIM)

Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ formatted, indented, documented, and commented.

The [Neuron Development Topics](https://neuronsimulator.github.io/nrn/dev/index.html) section of the documentation provides a starting point for understanding NEURON's internals.

### Building NEURON

To build NEURON, please follow the instructions [here](docs/install/install_instructions.md#installing-source-distributions).

### Code Formatting

Currently we have enabled CMake and Clang code formatting using [cmake-format](https://github.com/cheshirekow/cmake_format) and [clang-format](https://clang.llvm.org/docs/ClangFormat.html). Before submitting a PR, make sure to run cmake-format and clang-format as below:
Expand Down Expand Up @@ -142,9 +146,6 @@ Or,

See [cmake-format](https://github.com/cheshirekow/cmake_format) documentation for details.

make && make format-pr
```
## Python Contributions

The Python source code is located under `share/lib/python/neuron`. Python unit tests are
Expand Down
10 changes: 5 additions & 5 deletions bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include(CMakeListsNrnMech)
# =============================================================================
# nrnmech_makefile (based on coreneuron Configure templates)
# =============================================================================
nrn_configure_file(nrngui bin)
configure_file("nrngui.in" "nrngui" @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sortspike ${CMAKE_CURRENT_BINARY_DIR}/sortspike COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nrnivmodl_makefile_cmake.in
${PROJECT_BINARY_DIR}/bin/nrnmech_makefile @ONLY)
Expand All @@ -49,10 +49,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nrnpyenv.sh.in ${PROJECT_BINARY_DIR}/
# file(CHMOD ...) and v3.20+ support setting permissions directly in configure_file(...).
set(NRN_CONFIG_EXE_FILES "nrnivmodl" "neurondemo")
foreach(NRN_CONFIG_EXE_FILE ${NRN_CONFIG_EXE_FILES})
nrn_configure_dest_src(${NRN_CONFIG_EXE_FILE} bin/tmp ${NRN_CONFIG_EXE_FILE} bin)
configure_file("${NRN_CONFIG_EXE_FILE}.in" "tmp/${NRN_CONFIG_EXE_FILE}" @ONLY)
file(
COPY ${PROJECT_BINARY_DIR}/bin/tmp/${NRN_CONFIG_EXE_FILE}
DESTINATION ${PROJECT_BINARY_DIR}/bin
COPY "${CMAKE_CURRENT_BINARY_DIR}/tmp/${NRN_CONFIG_EXE_FILE}"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
FILE_PERMISSIONS
OWNER_READ
OWNER_WRITE
Expand All @@ -62,7 +62,7 @@ foreach(NRN_CONFIG_EXE_FILE ${NRN_CONFIG_EXE_FILES})
WORLD_READ
WORLD_EXECUTE)
endforeach()
file(REMOVE_RECURSE ${PROJECT_BINARY_DIR}/bin/tmp)
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/bin/tmp")

# =============================================================================
# Install targets
Expand Down
2 changes: 1 addition & 1 deletion bin/nrnivmodl-core.in
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ shopt -s nullglob
if [ -d "$params_MODS_PATH" ]; then
files=( "$params_MODS_PATH"/*.mod )
if [ ${#files} -eq 0 ]; then
echo "WARNING: No mod files found in '$(realpath ${params_MODS_PATH})', compiling default ones only!"
echo "WARNING: No mod files found in '$(readlink -f "${params_MODS_PATH}")', compiling default ones only!"
fi
else
echo "FATAL: Invalid mods directory: '$params_MODS_PATH'"
Expand Down
2 changes: 1 addition & 1 deletion bin/nrnivmodl.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export prefix
export bindir
export libdir

if command -v xcrun; then
if command -v xcrun >/dev/null 2>&1; then
@NRN_OSX_BUILD_TRUE@export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
@NRN_OSX_BUILD_TRUE@export MACOSX_DEPLOYMENT_TARGET="@CMAKE_OSX_DEPLOYMENT_TARGET@"
if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then
Expand Down
4 changes: 2 additions & 2 deletions bin/nrnivmodl_core_makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ CXX_LINK_EXE_CMD = $(CXX) $(CXXFLAGS) @CMAKE_EXE_LINKER_FLAGS@
CXX_SHARED_LIB_CMD = $(CXX) $(CXXFLAGS) @CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS@ @CMAKE_SHARED_LIBRARY_CXX_FLAGS@ @CMAKE_SHARED_LINKER_FLAGS@

# env variables required for mod2c or nmodl
NMODL_ENV_VAR = @CORENRN_SANITIZER_ENABLE_ENVIRONMENT_STRING@ PYTHONPATH=@CORENRN_NMODL_PYTHONPATH@:${CORENRN_LIB_DIR}/python MODLUNIT=$(CORENRN_SHARE_NMODL_DIR)/nrnunits.lib
NMODL_ENV_VAR = @CORENRN_SANITIZER_ENABLE_ENVIRONMENT_STRING@ PYTHONPATH=${PYTHONPATH}:@CORENRN_NMODL_PYTHONPATH@:${CORENRN_LIB_DIR}/python MODLUNIT=$(CORENRN_SHARE_NMODL_DIR)/nrnunits.lib

ifeq (@CORENRN_ENABLE_GPU@, ON)
nmodl_arguments_c=@NMODL_ACC_BACKEND_ARGS@ @NMODL_COMMON_ARGS@
Expand Down Expand Up @@ -145,7 +145,7 @@ endif


# main target to build binary
$(SPECIAL_EXE): $(corenrnmech_lib_target)
$(SPECIAL_EXE): $(corenrnmech_lib_target) $(CORENRN_SHARE_CORENRN_DIR)/coreneuron.cpp
@printf " => $(C_GREEN)Binary$(C_RESET) creating $(SPECIAL_EXE)\n"
$(CXX_LINK_EXE_CMD) -o $(SPECIAL_EXE) $(CORENRN_SHARE_CORENRN_DIR)/coreneuron.cpp \
-I$(CORENRN_INC_DIR) $(INCFLAGS) \
Expand Down
2 changes: 1 addition & 1 deletion bin/nrnivmodl_makefile_cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ C_GREEN := \033[32m

# Take the main and link with nrnmech.
# RPATH is set for DESTDIR_RPATH and coreneuron lib
special: $(mech_lib)
special: $(mech_lib) $(datadir)/nrnmain.cpp
@printf " => $(C_GREEN)LINKING$(C_RESET) executable \"${PWD}/$(special)\" LDFLAGS are: $(LDFLAGS)\n"
$(CXX_LINK_EXE) -I $(incdir) -I $(incdir)/nrncvode -DAUTO_DLOPEN_NRNMECH=0 $(datadir)/nrnmain.cpp -o $(special) \
-L$(OBJS_DIR) -l$(mech_libname) $(NRNLIB_FLAGS) -l$(mech_libname) $(extra_lib_link) -Wl,-rpath,'$(DESTDIR_RPATH)' -Wl,-rpath,$(libdir) $(LDFLAGS) $(EXTRA_LDFLAGS)
Expand Down

0 comments on commit dfd4813

Please sign in to comment.