Skip to content

Commit

Permalink
Merge branch 'master' into rxd_react_mem
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodk authored Jan 27, 2024
2 parents 91d1946 + 638c30c commit a93e7e3
Show file tree
Hide file tree
Showing 70 changed files with 1,109 additions and 2,119 deletions.
33 changes: 13 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
python: circleci/python@0.3.2
python: circleci/python@2.1.1

jobs:
manylinux2014-aarch64:
Expand All @@ -13,7 +13,7 @@ jobs:
type: string

machine:
image: ubuntu-2004:202101-01
image: default

resource_class: arm.medium

Expand Down Expand Up @@ -49,25 +49,18 @@ jobs:
# choose available python versions from pyenv
pyenv_py_ver=""
case << parameters.NRN_PYTHON_VERSION >> in
38) pyenv_py_ver="3.8.7" ;;
39) pyenv_py_ver="3.9.1" ;;
310) pyenv_py_ver="3.10.1" ;;
311) pyenv_py_ver="3.11.0" ;;
38) pyenv_py_ver="3.8" ;;
39) pyenv_py_ver="3.9" ;;
310) pyenv_py_ver="3.10" ;;
311) pyenv_py_ver="3.11" ;;
312) pyenv_py_ver="3.12" ;;
*) echo "Error: pyenv python version not specified!" && exit 1;;
esac
# install python dependencies: .10 is not available pyenv
if [ "<< parameters.NRN_PYTHON_VERSION >>" == "310" ]; then
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.10 libpython3.10 python3.10-venv
export PYTHON_EXE=$(which python3.10)
else
cd /opt/circleci/.pyenv/plugins/python-build/../.. && git pull && cd -
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $pyenv_py_ver --force
pyenv global $pyenv_py_ver
export PYTHON_EXE=$(which python)
fi
cd /opt/circleci/.pyenv/plugins/python-build/../.. && git fetch --all && git checkout -B master origin/master && cd -
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $pyenv_py_ver --force
pyenv global $pyenv_py_ver
export PYTHON_EXE=$(which python)
# test wheel
packaging/python/test_wheels.sh $PYTHON_EXE $(ls -t wheelhouse/*.whl)
Expand Down Expand Up @@ -95,7 +88,7 @@ workflows:
- /circleci\/.*/
matrix:
parameters:
NRN_PYTHON_VERSION: ["311"]
NRN_PYTHON_VERSION: ["312"]
NRN_NIGHTLY_UPLOAD: ["false"]

nightly:
Expand All @@ -110,5 +103,5 @@ workflows:
- manylinux2014-aarch64:
matrix:
parameters:
NRN_PYTHON_VERSION: ["38", "39", "310", "311"]
NRN_PYTHON_VERSION: ["38", "39", "310", "311", "312"]
NRN_NIGHTLY_UPLOAD: ["true"]
5 changes: 3 additions & 2 deletions .github/workflows/neuron-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
PY_MIN_VERSION: ${{ matrix.config.python_min_version || '3.8' }}
PY_MAX_VERSION: ${{ matrix.config.python_max_version || '3.11' }}
MUSIC_INSTALL_DIR: /opt/MUSIC
MUSIC_VERSION: 1.2.0
MUSIC_VERSION: 1.2.1

strategy:
matrix:
Expand Down Expand Up @@ -173,7 +173,8 @@ jobs:
curl -L -o MUSIC.zip https://github.com/INCF/MUSIC/archive/refs/tags/${MUSIC_VERSION}.zip
unzip MUSIC.zip && mv MUSIC-* MUSIC && cd MUSIC
./autogen.sh
./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource
# on some systems MPI library detection fails, provide exact flags/compilers
./configure --with-python-sys-prefix --prefix=$MUSIC_INSTALL_DIR --disable-anysource MPI_CXXFLAGS="-g -O3" MPI_CFLAGS="-g -O3" MPI_LDFLAGS=" " CC=mpicc CXX=mpicxx
make -j install
deactivate
working-directory: ${{runner.temp}}
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mac_m1_cmake_build:
- real_python=$(python3 resolve_shim.py)
- echo "python3=$(command -v python3) is really ${real_python}"
- PYTHONEXECUTABLE=${real_python} ${real_python} -mvenv venv
- venv/bin/python3 -m ensurepip --upgrade --default-pip
- venv/bin/pip install --upgrade pip -r nrn_requirements.txt
- git submodule update --init --recursive --force --depth 1 -- external/nmodl
- venv/bin/pip install --upgrade -r external/nmodl/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://dev.azure.com/neuronsimulator/nrn/_apis/build/status/neuronsimulator.nrn?branchName=master)](https://dev.azure.com/neuronsimulator/nrn/_build/latest?definitionId=1&branchName=master) [![Actions Status](https://github.com/neuronsimulator/nrn/workflows/Windows%20Installer/badge.svg)](https://github.com/neuronsimulator/nrn/actions) [![Actions Status](https://github.com/neuronsimulator/nrn/workflows/NEURON%20CI/badge.svg)](https://github.com/neuronsimulator/nrn/actions) [![codecov](https://codecov.io/gh/neuronsimulator/nrn/branch/master/graph/badge.svg?token=T7PIDw6LrC)](https://codecov.io/gh/neuronsimulator/nrn) [![Documentation Status](https://readthedocs.org/projects/nrn/badge/?version=latest)](http://nrn.readthedocs.io/?badge=latest)
[![Build Status](https://dev.azure.com/neuronsimulator/nrn/_apis/build/status/neuronsimulator.nrn?branchName=master)](https://dev.azure.com/neuronsimulator/nrn/_build/latest?definitionId=1&branchName=master) [![Actions Status](https://github.com/neuronsimulator/nrn/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/neuronsimulator/nrn/actions) [![Actions Status](https://github.com/neuronsimulator/nrn/workflows/NEURON%20CI/badge.svg)](https://github.com/neuronsimulator/nrn/actions) [![codecov](https://codecov.io/gh/neuronsimulator/nrn/branch/master/graph/badge.svg?token=T7PIDw6LrC)](https://codecov.io/gh/neuronsimulator/nrn) [![Documentation Status](https://readthedocs.org/projects/nrn/badge/?version=latest)](http://nrn.readthedocs.io/?badge=latest)

# NEURON
NEURON is a simulator for models of neurons and networks of neuron. See [http://neuron.yale.edu](http://neuron.yale.edu) for installers, source code, documentation, tutorials, announcements of
Expand Down
2 changes: 1 addition & 1 deletion ci/win_build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cd $BUILD_SOURCESDIRECTORY/build
-DNRN_BINARY_DIST_BUILD=ON \
-DPYTHON_EXECUTABLE=/c/Python38/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' \
-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' \
-DMPI_CXX_LIB_NAMES:STRING=msmpi \
-DMPI_C_LIB_NAMES:STRING=msmpi \
Expand Down
1 change: 1 addition & 0 deletions ci/win_download_deps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.8.exe htt
pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.9.exe https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe || goto :error
pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.10.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe || goto :error
pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.11.exe https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe || goto :error
pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile python-3.12.exe https://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe || goto :error

:: mpi
pwsh -command Invoke-WebRequest -MaximumRetryCount 4 -OutFile msmpisetup.exe https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe || goto :error
Expand Down
3 changes: 3 additions & 0 deletions ci/win_install_deps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ python-3.8.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustFo
python-3.9.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python39 || goto :error
python-3.10.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python310 || goto :error
python-3.11.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python311 || goto :error
python-3.12.exe /passive Include_pip=1 Include_test=0 PrependPath=1 DefaultJustForMeTargetDir=C:\Python312 || goto :error

:: fix msvcc version for all python3
pwsh -command "(Get-Content C:\Python38\Lib\distutils\cygwinccompiler.py) -replace 'elif msc_ver == ''1600'':', 'elif msc_ver == ''1916'':' | Out-File C:\Python38\Lib\distutils\cygwinccompiler.py"
Expand All @@ -26,6 +27,8 @@ 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:\Python312\python.exe -m pip install setuptools || goto :error

:: install nsis
nsis-3.05-setup.exe /S || goto :error
Expand Down
2 changes: 1 addition & 1 deletion cmake/CompilerHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "PGI" OR CMAKE_C_COMPILER_ID MATCHES "NVHPC")
# Random123 does not play nicely with NVHPC 21.11+'s detection of ABM features, see:
# https://github.com/BlueBrain/CoreNeuron/issues/724 and
# https://github.com/DEShawResearch/random123/issues/6.
list(APPEND NRN_COMPILE_DEFS R123_USE_INTRIN_H=0)
list(APPEND NRN_R123_COMPILE_DEFS R123_USE_INTRIN_H=0)
endif()
else()
set(NRN_HAVE_NVHPC_COMPILER OFF)
Expand Down
18 changes: 6 additions & 12 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ set(STRUCTURED_HEADER_FILES_TO_INSTALL
neuron/container/generic_data_handle.hpp neuron/container/non_owning_soa_identifier.hpp
neuron/model_data_fwd.hpp)
set(HEADER_FILES_TO_INSTALL
gnu/mcran4.h
gnu/nrnisaac.h
gnu/nrnran123.h
nrniv/backtrace_utils.h
nrniv/bbsavestate.h
nrnmpi/nrnmpidec.h
Expand Down Expand Up @@ -37,14 +40,12 @@ set(HEADER_FILES_TO_INSTALL
oc/hocgetsym.h
oc/hoclist.h
oc/hocparse.h
oc/mcran4.h
oc/mech_api.h
oc/memory.hpp
oc/nrnapi.h
oc/nrnassrt.h
oc/nrnisaac.h
oc/nrnmpi.h
oc/nrnrandom.h
oc/nrnran123.h
oc/oc_ansi.h
oc/ocfunc.h
oc/ocmisc.h
Expand All @@ -68,8 +69,6 @@ set(HEADER_FILES_TO_INSTALL
scopmath/sparse_thread.hpp
scopmath/ssimplic.hpp
scopmath/ssimplic_thread.hpp
sparse13/cspmatrix.h
sparse13/cspredef.h
sparse13/spconfig.h
sparse13/spmatrix.h)

Expand All @@ -78,16 +77,10 @@ set(HEADER_FILES_TO_INSTALL
# =============================================================================
set(NRN_HEADERS_INCLUDE_LIST)

# =============================================================================
# Lists of random number related files
# =============================================================================
set(RAN_FILE_LIST isaac64.cpp mcran4.cpp nrnisaac.cpp nrnran123.cpp)

# =============================================================================
# Files in oc directory
# =============================================================================
set(OC_FILE_LIST
${RAN_FILE_LIST}
audit.cpp
axis.cpp
code.cpp
Expand All @@ -103,6 +96,8 @@ set(OC_FILE_LIST
hoc_oop.cpp
list.cpp
math.cpp
oc_mcran4.cpp
memory.cpp
mswinprt.cpp
nonlin.cpp
ocerf.cpp
Expand Down Expand Up @@ -222,7 +217,6 @@ set(NRNIV_FILE_LIST
cxprop.cpp
datapath.cpp
finithnd.cpp
geometry3d.cpp
glinerec.cpp
hocmech.cpp
impedanc.cpp
Expand Down
3 changes: 0 additions & 3 deletions nrn_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ pytest-cov
mpi4py
numpy
find_libpython

# For python 3.12
setuptools
2 changes: 1 addition & 1 deletion share/lib/python/neuron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ def _get_color(variable, val, cmap, lo, hi, val_range):
elif val > hi:
col = color_to_hex(cmap(255))
else:
val = color_to_hex(128)
col = color_to_hex(cmap(128))
else:
col = color_to_hex(
cmap(int(255 * (min(max(val, lo), hi) - lo) / (val_range)))
Expand Down
3 changes: 0 additions & 3 deletions src/coreneuron/mpi/nrnmpiuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@

/* define to the dll path if you want to load automatically */
#undef DLL_DEFAULT_FNAME

/* Number of times to retry a failed open */
#undef FILE_OPEN_RETRY
2 changes: 1 addition & 1 deletion src/coreneuron/utils/randoms/nrnran123.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace random123_global {
#else
#define g_k_qualifiers
#endif
g_k_qualifiers philox4x32_key_t g_k{};
g_k_qualifiers philox4x32_key_t g_k{{0, 0}};

// Cannot refer to g_k directly from a nrn_pragma_acc(routine seq) method like
// coreneuron_random123_philox4x32_helper, and cannot have this inlined there at
Expand Down
9 changes: 9 additions & 0 deletions src/gnu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ add_library(
Erlang.cpp
Geom.cpp
HypGeom.cpp
isaac64.cpp
Isaac64RNG.cpp
LogNorm.cpp
MCellRan4RNG.cpp
mcran4.cpp
MLCG.cpp
NegExp.cpp
Normal.cpp
nrnisaac.cpp
nrnran123.cpp
Poisson.cpp
Rand.cpp
Random.cpp
RndInt.cpp
RNG.cpp
Uniform.cpp
Weibull.cpp)
set_property(TARGET nrngnu PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(nrngnu SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/external/Random123/include")
target_compile_definitions(nrngnu PRIVATE ${NRN_R123_COMPILE_DEFS})
20 changes: 20 additions & 0 deletions src/gnu/Isaac64RNG.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Isaac64RNG.hpp"

uint32_t Isaac64::cnt_ = 0;

Isaac64::Isaac64(std::uint32_t seed) {
if (cnt_ == 0) {
cnt_ = 0xffffffff;
}
--cnt_;
seed_ = seed;
if (seed_ == 0) {
seed_ = cnt_;
}
rng_ = nrnisaac_new();
reset();
}

Isaac64::~Isaac64() {
nrnisaac_delete(rng_);
}
33 changes: 33 additions & 0 deletions src/gnu/Isaac64RNG.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include <cstdint>

#include "RNG.h"
#include "nrnisaac.h"

class Isaac64: public RNG {
public:
Isaac64(std::uint32_t seed = 0);
~Isaac64();
std::uint32_t asLong() {
return nrnisaac_uint32_pick(rng_);
}
void reset() {
nrnisaac_init(rng_, seed_);
}
double asDouble() {
return nrnisaac_dbl_pick(rng_);
}
std::uint32_t seed() {
return seed_;
}
void seed(std::uint32_t s) {
seed_ = s;
reset();
}

private:
std::uint32_t seed_;
void* rng_;
static std::uint32_t cnt_;
};
15 changes: 15 additions & 0 deletions src/gnu/MCellRan4RNG.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "MCellRan4RNG.hpp"

MCellRan4::MCellRan4(std::uint32_t ihigh, std::uint32_t ilow) {
++cnt_;
ilow_ = ilow;
ihigh_ = ihigh;
if (ihigh_ == 0) {
ihigh_ = cnt_;
ihigh_ = (std::uint32_t) asLong();
}
orig_ = ihigh_;
}
MCellRan4::~MCellRan4() {}

std::uint32_t MCellRan4::cnt_ = 0;
34 changes: 34 additions & 0 deletions src/gnu/MCellRan4RNG.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <cstdint>

#include "RNG.h"
#include "mcran4.h"

// The decision that has to be made is whether each generator instance
// should have its own seed or only one seed for all. We choose separate
// seed for each but if arg not present or 0 then seed chosen by system.

// the addition of ilow > 0 means that value is used for the lowindex
// instead of the mcell_ran4_init global 32 bit lowindex.

class MCellRan4: public RNG {
public:
MCellRan4(std::uint32_t ihigh = 0, std::uint32_t ilow = 0);
virtual ~MCellRan4();
virtual std::uint32_t asLong() {
return (std::uint32_t) (ilow_ == 0 ? mcell_iran4(&ihigh_) : nrnRan4int(&ihigh_, ilow_));
}
virtual void reset() {
ihigh_ = orig_;
}
virtual double asDouble() {
return (ilow_ == 0 ? mcell_ran4a(&ihigh_) : nrnRan4dbl(&ihigh_, ilow_));
}
std::uint32_t ihigh_;
std::uint32_t orig_;
std::uint32_t ilow_;

private:
static std::uint32_t cnt_;
};
Empty file added src/gnu/NrnRandom123RNG.cpp
Empty file.
Loading

0 comments on commit a93e7e3

Please sign in to comment.