From 952d3d94983da9a78cd295fdf18958dba2273be5 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 10 Jan 2025 13:04:19 +0100 Subject: [PATCH 01/30] Move to `manylinux_2_28` base image --- packaging/python/Dockerfile | 54 ++++++------------------------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/packaging/python/Dockerfile b/packaging/python/Dockerfile index 95931335cc..b73e7752a2 100644 --- a/packaging/python/Dockerfile +++ b/packaging/python/Dockerfile @@ -1,9 +1,9 @@ -ARG MANYLINUX_IMAGE=manylinux2014_x86_64 +ARG MANYLINUX_IMAGE=manylinux_2_28_x86_64 FROM quay.io/pypa/$MANYLINUX_IMAGE -LABEL authors="Pramod Kumbhar, Fernando Pereira, Alexandru Savulescu" +LABEL authors="Pramod Kumbhar, Fernando Pereira, Alexandru Savulescu, Goran Jelic-Cizmek" -RUN gcc --version && python --version +RUN gcc --version && python3 --version # install basic packages RUN yum -y install \ @@ -13,6 +13,11 @@ RUN yum -y install \ vim \ curl \ unzip \ + flex \ + readline \ + ncurses \ + mpich \ + openmpi \ bison \ autoconf \ automake \ @@ -28,47 +33,6 @@ RUN yum -y install \ WORKDIR /root -# newer flex with rpmbuild (manylinux2014 based on Centos7 currently has flex < 2.6) -RUN rpmbuild --rebuild https://vault.centos.org/8-stream/AppStream/Source/SPackages/flex-2.6.1-9.el8.src.rpm \ - && yum -y install rpmbuild/RPMS/*/flex-2.6.1-9.el7.*.rpm \ - && rm -rf rpmbuild - -RUN wget http://ftpmirror.gnu.org/ncurses/ncurses-6.4.tar.gz \ - && tar -xvzf ncurses-6.4.tar.gz \ - && cd ncurses-6.4 \ - && ./configure --prefix=/nrnwheel/ncurses --without-shared --without-debug CFLAGS="-fPIC" \ - && make -j install \ - && cd .. && rm -rf ncurses-6.4 ncurses-6.4.tar.gz - -RUN curl -L -o mpich-3.3.2.tar.gz http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz \ - && tar -xvzf mpich-3.3.2.tar.gz \ - && cd mpich-3.3.2 \ - && ./configure --disable-fortran --prefix=/nrnwheel/mpich \ - && make -j install \ - && cd .. && rm -rf mpich-3.3.2 mpich-3.3.2.tar.gz \ - && rm -rf /nrnwheel/mpich/share/doc /nrnwheel/mpich/share/man - -RUN curl -L -o openmpi-4.0.3.tar.gz https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz \ - && tar -xvzf openmpi-4.0.3.tar.gz \ - && cd openmpi-4.0.3 \ - && ./configure --prefix=/nrnwheel/openmpi \ - && make -j install \ - && cd .. && rm -rf openmpi-4.0.3 openmpi-4.0.3.tar.gz - -RUN curl -L -o readline-7.0.tar.gz https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz \ - && tar -xvzf readline-7.0.tar.gz \ - && cd readline-7.0 \ - && ./configure --prefix=/nrnwheel/readline --disable-shared CFLAGS="-fPIC" \ - && make -j install \ - && cd .. && rm -rf readline-7.0 readline-7.0.tar.gz - -# create readline with ncurses -RUN cd /nrnwheel/readline/lib \ - && ar -x libreadline.a \ - && ar -x ../../ncurses/lib/libncurses.a \ - && ar cq libreadline.a *.o \ - && rm *.o - # NOTE: NMODL transpiler is used in during build step but it requires # sympy+python available in order to translate MOD files to C++. But under # manylinux container, Python (libpython) is not available and hence we can't @@ -83,9 +47,7 @@ RUN curl -L -o Python-3.10.0.tar.gz https://www.python.org/ftp/python/3.10.0/Pyt && make -j altinstall \ && cd .. && rm -rf Python-3.10.0 Python-3.10.0.tar.gz -ENV PATH /nrnwheel/openmpi/bin:$PATH RUN yum -y install epel-release libX11-devel libXcomposite-devel vim-enhanced && yum -y clean all && rm -rf /var/cache -RUN yum -y remove ncurses-devel # Copy Dockerfile for reference COPY Dockerfile . From 0b01fd83a6167e919f8ae3c03b58dcbdf7ca77e6 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 10 Jan 2025 14:17:33 +0100 Subject: [PATCH 02/30] Test manylinux_2_28 image --- .circleci/config.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c1d872ad41..29a9cdec2b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: -e NRN_RELEASE_UPLOAD \ -e SETUPTOOLS_SCM_PRETEND_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'neuronsimulator/neuron_wheel:latest-aarch64' \ + 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28-aarch64' \ packaging/python/build_wheels.bash linux 3<< parameters.NRN_PYTHON_VERSION_MINOR >> coreneuron - store_artifacts: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5970a4243f..ed8ed98c7d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,7 +70,7 @@ stages: -e NRN_RELEASE_UPLOAD \ -e SETUPTOOLS_SCM_PRETEND_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'neuronsimulator/neuron_wheel:latest-x86_64' \ + 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28-x86_64' \ packaging/python/build_wheels.bash linux $(python.version) coreneuron displayName: 'Building ManyLinux Wheel' From 38aa6c47c2ab8f4e7a33039be88d174f641af494 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 11:38:27 +0100 Subject: [PATCH 03/30] Modify Dockerfile and build script --- packaging/python/Dockerfile | 36 ++++++++++++++++++++++++------ packaging/python/build_wheels.bash | 4 ++-- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/packaging/python/Dockerfile b/packaging/python/Dockerfile index b73e7752a2..80cff2b56c 100644 --- a/packaging/python/Dockerfile +++ b/packaging/python/Dockerfile @@ -14,10 +14,8 @@ RUN yum -y install \ curl \ unzip \ flex \ - readline \ - ncurses \ - mpich \ - openmpi \ + mpich-devel \ + openmpi-devel \ bison \ autoconf \ automake \ @@ -33,6 +31,27 @@ RUN yum -y install \ WORKDIR /root +RUN wget http://ftpmirror.gnu.org/ncurses/ncurses-6.4.tar.gz \ + && tar -xvzf ncurses-6.4.tar.gz \ + && cd ncurses-6.4 \ + && ./configure --prefix=/nrnwheel/ncurses --without-shared --without-debug CFLAGS="-fPIC" \ + && make -j install \ + && cd .. && rm -rf ncurses-6.4 ncurses-6.4.tar.gz + +RUN curl -L -o readline-7.0.tar.gz https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz \ + && tar -xvzf readline-7.0.tar.gz \ + && cd readline-7.0 \ + && ./configure --prefix=/nrnwheel/readline --disable-shared CFLAGS="-fPIC" \ + && make -j install \ + && cd .. && rm -rf readline-7.0 readline-7.0.tar.gz + +# create readline with ncurses +RUN cd /nrnwheel/readline/lib \ + && ar -x libreadline.a \ + && ar -x ../../ncurses/lib/libncurses.a \ + && ar cq libreadline.a *.o \ + && rm *.o + # NOTE: NMODL transpiler is used in during build step but it requires # sympy+python available in order to translate MOD files to C++. But under # manylinux container, Python (libpython) is not available and hence we can't @@ -48,9 +67,7 @@ RUN curl -L -o Python-3.10.0.tar.gz https://www.python.org/ftp/python/3.10.0/Pyt && cd .. && rm -rf Python-3.10.0 Python-3.10.0.tar.gz RUN yum -y install epel-release libX11-devel libXcomposite-devel vim-enhanced && yum -y clean all && rm -rf /var/cache - -# Copy Dockerfile for reference -COPY Dockerfile . +RUN yum -y remove ncurses-devel # build wheels from there WORKDIR /root @@ -59,3 +76,8 @@ WORKDIR /root RUN rm -fr /opt/python/cp313-cp313t ENV NMODL_PYLIB=/nrnwheel/python/lib/libpython3.10.so.1.0 + +ENV PATH /usr/lib64/openmpi/bin:$PATH + +# Copy Dockerfile for reference +COPY Dockerfile . diff --git a/packaging/python/build_wheels.bash b/packaging/python/build_wheels.bash index abea2dcb5b..564eb9f49a 100755 --- a/packaging/python/build_wheels.bash +++ b/packaging/python/build_wheels.bash @@ -193,7 +193,7 @@ coreneuron=$3 case "$1" in linux) - MPI_INCLUDE_HEADERS="/nrnwheel/openmpi/include;/nrnwheel/mpich/include" + MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)" # Check for MPT headers. On Azure, we extract them from a secure file and mount them in the docker image in: MPT_INCLUDE_PATH="/nrnwheel/mpt/include" if [ -d "$MPT_INCLUDE_PATH" ]; then @@ -221,7 +221,7 @@ case "$1" in MPI_INCLUDE_HEADERS="${BREW_PREFIX}/opt/openmpi/include;${BREW_PREFIX}/opt/mpich/include" build_wheel_osx $(which python3) "$coreneuron" "$MPI_INCLUDE_HEADERS" else - MPI_INCLUDE_HEADERS="/usr/lib/x86_64-linux-gnu/openmpi/include;/usr/include/x86_64-linux-gnu/mpich" + MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)" build_wheel_linux $(which python3) "$coreneuron" "$MPI_INCLUDE_HEADERS" fi ls wheelhouse/ From c7ae29e5b2a5f715f0f476c32272b2cabf818530 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 11:53:12 +0100 Subject: [PATCH 04/30] Remove BBP-specific testing --- packaging/python/test_wheels.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packaging/python/test_wheels.sh b/packaging/python/test_wheels.sh index 853d7cbd7e..66d3f27009 100755 --- a/packaging/python/test_wheels.sh +++ b/packaging/python/test_wheels.sh @@ -36,10 +36,6 @@ run_mpi_test () { echo "======= Testing $mpi_name ========" if [ -n "$mpi_module" ]; then echo "Loading module $mpi_module" - if [[ $(hostname -f) = *r*bbp.epfl.ch* ]]; then - echo "\tusing unstable on BB5" - module load unstable - fi module load $mpi_module fi @@ -191,12 +187,6 @@ run_parallel_test() { sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/openmpi/include run_mpi_test "mpirun.openmpi" "OpenMPI" "" - # BB5 with multiple MPI libraries - elif [[ $(hostname -f) = *r*bbp.epfl.ch* ]]; then - run_mpi_test "srun" "HPE-MPT" "hpe-mpi" - run_mpi_test "mpirun" "Intel MPI" "intel-oneapi-mpi" - run_mpi_test "srun" "MVAPICH2" "mvapich2" - # circle-ci build elif [[ "$CIRCLECI" == "true" ]]; then sudo update-alternatives --set mpi-aarch64-linux-gnu /usr/include/aarch64-linux-gnu/mpich From 2571c650682ab8fd309ebd39f16b59699e8f8b3b Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 14:48:57 +0100 Subject: [PATCH 05/30] Set min version of GCC everywhere Also unify arches in CI --- packaging/python/Dockerfile | 11 +++++++++++ packaging/python/build_wheels.bash | 4 +++- packaging/python/test_wheels.sh | 19 ++++++------------- share/lib/python/scripts/_binwrapper.py | 14 +++++++------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/packaging/python/Dockerfile b/packaging/python/Dockerfile index 80cff2b56c..10204232d3 100644 --- a/packaging/python/Dockerfile +++ b/packaging/python/Dockerfile @@ -3,6 +3,17 @@ ARG MANYLINUX_IMAGE=manylinux_2_28_x86_64 FROM quay.io/pypa/$MANYLINUX_IMAGE LABEL authors="Pramod Kumbhar, Fernando Pereira, Alexandru Savulescu, Goran Jelic-Cizmek" +# problem: libstdc++ is _not_ forwards compatible, so if we try to compile mod +# files on a system that ships a version of it older than the one used for +# building the wheel itself, we'll get linker errors. +# solution: use a well-defined oldest-supported version of GCC +# we need to do this _before_ building any libraries from source +ARG OLDEST_SUPPORTED_GCC_VERSION=10 +RUN yum install -y gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc-c++ +ENV PATH /opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/bin:$PATH +ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib/dyninst +ENV DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root + RUN gcc --version && python3 --version # install basic packages diff --git a/packaging/python/build_wheels.bash b/packaging/python/build_wheels.bash index 564eb9f49a..cbf62ffccf 100755 --- a/packaging/python/build_wheels.bash +++ b/packaging/python/build_wheels.bash @@ -221,7 +221,9 @@ case "$1" in MPI_INCLUDE_HEADERS="${BREW_PREFIX}/opt/openmpi/include;${BREW_PREFIX}/opt/mpich/include" build_wheel_osx $(which python3) "$coreneuron" "$MPI_INCLUDE_HEADERS" else - MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)" + # first two are for AlmaLinux 8 (default for manylinux_2_28); + # second two are for Debian/Ubuntu derivatives + MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m);/usr/lib/$(uname -m)-linux-gnu/openmpi/include;/usr/include/$(uname -m)-linux-gnu/mpich" build_wheel_linux $(which python3) "$coreneuron" "$MPI_INCLUDE_HEADERS" fi ls wheelhouse/ diff --git a/packaging/python/test_wheels.sh b/packaging/python/test_wheels.sh index 66d3f27009..a53dfce3f2 100755 --- a/packaging/python/test_wheels.sh +++ b/packaging/python/test_wheels.sh @@ -5,7 +5,7 @@ set -xe # See CMake's CMAKE_HOST_SYSTEM_PROCESSOR documentation # On the systems where we are building wheel we can rely # on uname -m. Note that this is just wheel testing script. -ARCH_DIR=`uname -m` +ARCH_DIR="$(uname -m)" if [ ! -f setup.py ]; then echo "Error: Please launch $0 from the root dir" @@ -175,23 +175,16 @@ run_parallel_test() { export DYLD_LIBRARY_PATH=${BREW_PREFIX}/opt/open-mpi/lib:$DYLD_LIBRARY_PATH run_mpi_test "${BREW_PREFIX}/opt/open-mpi/bin/mpirun" "OpenMPI" "" - # CI Linux or Azure Linux - elif [[ "$CI_OS_NAME" == "linux" || "$AGENT_OS" == "Linux" ]]; then + # CI Linux or Azure Linux or circleCI build (all on Debian/Ubuntu) + elif [[ "$CI_OS_NAME" == "linux" || "$AGENT_OS" == "Linux" || "$CIRCLECI" == "true" ]]; then # make debugging easier sudo update-alternatives --get-selections | grep mpi - sudo update-alternatives --list mpi-x86_64-linux-gnu + sudo update-alternatives --list mpi-${ARCH_DIR}-linux-gnu # choose mpich - sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich + sudo update-alternatives --set mpi-${ARCH_DIR}-linux-gnu /usr/include/${ARCH_DIR}-linux-gnu/mpich run_mpi_test "mpirun.mpich" "MPICH" "" # choose openmpi - sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/openmpi/include - run_mpi_test "mpirun.openmpi" "OpenMPI" "" - - # circle-ci build - elif [[ "$CIRCLECI" == "true" ]]; then - sudo update-alternatives --set mpi-aarch64-linux-gnu /usr/include/aarch64-linux-gnu/mpich - run_mpi_test "mpirun.mpich" "MPICH" "" - sudo update-alternatives --set mpi-aarch64-linux-gnu /usr/lib/aarch64-linux-gnu/openmpi/include + sudo update-alternatives --set mpi-${ARCH_DIR}-linux-gnu /usr/lib/${ARCH_DIR}-linux-gnu/openmpi/include run_mpi_test "mpirun.openmpi" "OpenMPI" "" # linux desktop or docker container used for wheel diff --git a/share/lib/python/scripts/_binwrapper.py b/share/lib/python/scripts/_binwrapper.py index 1fb7e417ab..906522a376 100755 --- a/share/lib/python/scripts/_binwrapper.py +++ b/share/lib/python/scripts/_binwrapper.py @@ -7,6 +7,7 @@ import shutil import subprocess import sys +import warnings from importlib.metadata import metadata, PackageNotFoundError from importlib.util import find_spec from pathlib import Path @@ -44,8 +45,8 @@ def _set_default_compiler(): os.environ.setdefault("CXX", ccompiler.compiler_cxx[0]) -def _check_cpp_compiler_version(): - """Check if GCC compiler is >= 9.0 otherwise show warning""" +def _check_cpp_compiler_version(min_version: str): + """Check if GCC compiler is >= min supported one, otherwise show warning""" try: cpp_compiler = os.environ.get("CXX", "") version = subprocess.run( @@ -55,10 +56,9 @@ def _check_cpp_compiler_version(): version = subprocess.run( [cpp_compiler, "-dumpversion"], stdout=subprocess.PIPE ).stdout.decode("utf-8") - if Version(version) <= Version("9.0"): - print( - "Warning: GCC >= 9.0 is required with this version of NEURON but found", - version, + if Version(version) <= Version(min_version): + warnings.warn( + f"Warning: GCC >= {min_version} is required with this version of NEURON but found {version}", ) except: pass @@ -111,7 +111,7 @@ def _wrap_executable(output_name): if exe.endswith("nrnivmodl"): # To create a wrapper for special (so it also gets ENV vars) we intercept nrnivmodl - _check_cpp_compiler_version() + _check_cpp_compiler_version("10.0") subprocess.check_call([exe, *sys.argv[1:]]) _wrap_executable("special") sys.exit(0) From d29bf6f4e96e334088bcfd426d555247bc6b7701 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 15:13:49 +0100 Subject: [PATCH 06/30] Change tag of Docker image --- .circleci/config.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 29a9cdec2b..7929581686 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,7 +31,7 @@ jobs: -e NRN_RELEASE_UPLOAD \ -e SETUPTOOLS_SCM_PRETEND_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28-aarch64' \ + 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' \ packaging/python/build_wheels.bash linux 3<< parameters.NRN_PYTHON_VERSION_MINOR >> coreneuron - store_artifacts: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ed8ed98c7d..a081844ac0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,7 +70,7 @@ stages: -e NRN_RELEASE_UPLOAD \ -e SETUPTOOLS_SCM_PRETEND_VERSION \ -e NRN_BUILD_FOR_UPLOAD=1 \ - 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28-x86_64' \ + 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' \ packaging/python/build_wheels.bash linux $(python.version) coreneuron displayName: 'Building ManyLinux Wheel' From de3fcc824b9be9b5a17687cb8db1fae755eb898b Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 15:33:22 +0100 Subject: [PATCH 07/30] Cleanup Docker image to reduce size --- packaging/python/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packaging/python/Dockerfile b/packaging/python/Dockerfile index 10204232d3..d50bb54f6c 100644 --- a/packaging/python/Dockerfile +++ b/packaging/python/Dockerfile @@ -9,7 +9,10 @@ LABEL authors="Pramod Kumbhar, Fernando Pereira, Alexandru Savulescu, Goran Jeli # solution: use a well-defined oldest-supported version of GCC # we need to do this _before_ building any libraries from source ARG OLDEST_SUPPORTED_GCC_VERSION=10 -RUN yum install -y gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc-c++ +RUN yum -y install \ + gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc \ + gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}-gcc-c++ \ + && yum -y clean all && rm -rf /var/cache ENV PATH /opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/bin:$PATH ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root/usr/lib/dyninst ENV DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-${OLDEST_SUPPORTED_GCC_VERSION}/root From 44ef470918d7a1643af74cea68a9e36426d97082 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 16:18:08 +0100 Subject: [PATCH 08/30] MPI headers need some tweaking --- packaging/python/build_wheels.bash | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packaging/python/build_wheels.bash b/packaging/python/build_wheels.bash index cbf62ffccf..c022bdec7f 100755 --- a/packaging/python/build_wheels.bash +++ b/packaging/python/build_wheels.bash @@ -193,7 +193,15 @@ coreneuron=$3 case "$1" in linux) - MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m)" + MPI_POSSIBLE_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m) /usr/include/mpich-$(uname -m) /usr/lib/$(uname -m)-linux-gnu/openmpi/include /usr/include/$(uname -m)-linux-gnu/mpich" + MPI_INCLUDE_HEADERS="" + for dir in $MPI_POSSIBLE_INCLUDE_HEADERS + do + if [ -d "${dir}" ]; then + MPI_INCLUDE_HEADERS="${MPI_INCLUDE_HEADERS};${dir}" + fi + done + # Check for MPT headers. On Azure, we extract them from a secure file and mount them in the docker image in: MPT_INCLUDE_PATH="/nrnwheel/mpt/include" if [ -d "$MPT_INCLUDE_PATH" ]; then @@ -223,7 +231,14 @@ case "$1" in else # first two are for AlmaLinux 8 (default for manylinux_2_28); # second two are for Debian/Ubuntu derivatives - MPI_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m);/usr/include/mpich-$(uname -m);/usr/lib/$(uname -m)-linux-gnu/openmpi/include;/usr/include/$(uname -m)-linux-gnu/mpich" + MPI_POSSIBLE_INCLUDE_HEADERS="/usr/include/openmpi-$(uname -m) /usr/include/mpich-$(uname -m) /usr/lib/$(uname -m)-linux-gnu/openmpi/include /usr/include/$(uname -m)-linux-gnu/mpich" + MPI_INCLUDE_HEADERS="" + for dir in $MPI_POSSIBLE_INCLUDE_HEADERS + do + if [ -d "${dir}" ]; then + MPI_INCLUDE_HEADERS="${MPI_INCLUDE_HEADERS};${dir}" + fi + done build_wheel_linux $(which python3) "$coreneuron" "$MPI_INCLUDE_HEADERS" fi ls wheelhouse/ From 4ffe46cea6a95432aaf1038f7b5f5cdbe8b400f2 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 13 Jan 2025 21:42:39 +0100 Subject: [PATCH 09/30] Fix checking of compiler --- share/lib/python/scripts/_binwrapper.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/share/lib/python/scripts/_binwrapper.py b/share/lib/python/scripts/_binwrapper.py index 906522a376..7bc439a603 100755 --- a/share/lib/python/scripts/_binwrapper.py +++ b/share/lib/python/scripts/_binwrapper.py @@ -50,15 +50,18 @@ def _check_cpp_compiler_version(min_version: str): try: cpp_compiler = os.environ.get("CXX", "") version = subprocess.run( - [cpp_compiler, "--version"], stdout=subprocess.PIPE + [cpp_compiler, "--version"], + stdout=subprocess.PIPE, ).stdout.decode("utf-8") - if "GCC" in version: + if "gcc" in version.lower() or "gnu" in version.lower(): version = subprocess.run( - [cpp_compiler, "-dumpversion"], stdout=subprocess.PIPE + [cpp_compiler, "-dumpversion"], + stdout=subprocess.PIPE, ).stdout.decode("utf-8") if Version(version) <= Version(min_version): warnings.warn( - f"Warning: GCC >= {min_version} is required with this version of NEURON but found {version}", + f"Warning: GCC >= {min_version} is required with this version of NEURON" + f"but found version {version}", ) except: pass From fae53dae502c756d9ddba4340530b35b055c7ace Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 14 Jan 2025 14:52:32 +0100 Subject: [PATCH 10/30] Update docs and CI vars --- .circleci/config.yml | 6 ++--- docs/install/install_instructions.md | 11 +++++++++- docs/install/python_wheels.md | 33 ++-------------------------- packaging/python/README.md | 2 +- 4 files changed, 16 insertions(+), 36 deletions(-) mode change 120000 => 100644 packaging/python/README.md diff --git a/.circleci/config.yml b/.circleci/config.yml index 7929581686..b7269b66ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ orbs: python: circleci/python@3.0.0 jobs: - manylinux2014-aarch64: + manylinux_2_28-aarch64: parameters: NRN_PYTHON_VERSION_MINOR: @@ -71,7 +71,7 @@ workflows: build-workflow: jobs: - - manylinux2014-aarch64: + - manylinux_2_28-aarch64: filters: branches: only: @@ -91,7 +91,7 @@ workflows: only: - master jobs: - - manylinux2014-aarch64: + - manylinux_2_28-aarch64: matrix: parameters: NRN_PYTHON_VERSION_MINOR: ["9", "10", "11", "12", "13"] diff --git a/docs/install/install_instructions.md b/docs/install/install_instructions.md index a5024dd9df..3a40359ba9 100644 --- a/docs/install/install_instructions.md +++ b/docs/install/install_instructions.md @@ -107,7 +107,7 @@ architecture. #### Linux -Like Mac OS, since 7.8.1 release python wheels are provided and you can use `pip` to install NEURON by opening a terminal and typing: +Like Mac OS, since 7.8.1 release Python wheels are provided and you can use `pip` to install NEURON by opening a terminal and typing: ``` pip3 install neuron @@ -116,6 +116,15 @@ pip3 install neuron Note that Python2 wheels are provided for the 8.0.x release series exclusively. Also, we are not providing .rpm or .deb installers for recent releases. +**Note**: as of NEURON major version 9, the minimum system requirements for using NEURON Python wheels on Linux are: + +* Debian 10 or higher +* Ubuntu 18.10 or higher +* Fedora 29 or higher +* CentOS/RHEL 8 or higher + +Furthermore, GCC >= 10 is required (older versions of GCC may work, but are not recommended). + #### Windows On Windows, the only recommended way to install NEURON is using the binary installer. You can download alpha diff --git a/docs/install/python_wheels.md b/docs/install/python_wheels.md index 016134d3ce..8456174bcd 100644 --- a/docs/install/python_wheels.md +++ b/docs/install/python_wheels.md @@ -4,7 +4,7 @@ ## Linux wheels In order to have NEURON binaries run on most Linux distros, we rely on the [manylinux project](https://github.com/pypa/manylinux). -Current NEURON Linux image is based on `manylinux2014`. +Current NEURON Linux image is based on `manylinux_2_28`. ### Setting up Docker @@ -35,23 +35,8 @@ Refer to the following image for the NEURON Docker Image workflow: ![](images/docker-workflow.png) -### Building the docker images automatically -If you run the workflow manually on Gitlab (with the "Run pipeline" button), it will now have the `mac_m1_container_build` and `x86_64_container_build` jobs added to it. These jobs need to be started manually and will not affect the overal workflow status. They don't need to be run every time, just when a refresh of the container images is necessary. -They will build the container images and push to docker hub. If you want to, you can still build manually (see next section), but there shouldn't be a requirement to do so any more. - -A word of warning: podman on OSX uses a virtual machine. The job can take care of starting it, but we generally try to have it running to avoid jobs cleaning up after themselves and killing the machine for other jobs. When starting the machine, set the variables that need to be set during the container build, ie. proxy and `BUILDAH_FORMAT`. - -`BUILDAH_FORMAT` ensures that `ONBUILD` instructions are enabled. - -``` -export http_proxy=http://bbpproxy.epfl.ch:80 -export https_proxy=http://bbpproxy.epfl.ch:80 -export HTTP_PROXY=http://bbpproxy.epfl.ch:80 -export HTTPS_PROXY=http://bbpproxy.epfl.ch:80 -export BUILDAH_FORMAT=docker -``` - ### Building the docker image manually + After making updates to any of the docker files, you can build the image with: ``` cd nrn/packaging/python @@ -108,11 +93,6 @@ For `HPE-MPT MPI`, since it's not open source, you need to acquire the headers a docker run -v $PWD/nrn:/root/nrn -w /root/nrn -v $PWD/mpt-headers/2.21/include:/nrnwheel/mpt/include -it neuronsimulator/neuron_wheel:latest-x86_64 bash ``` where `$PWD/mpt-headers` is the path to the HPE-MPT MPI headers on the host machine that end up mounted at `/nrnwheel/mpt/include`. -You can download the headers with: - -``` -git clone ssh://bbpcode.epfl.ch/user/kumbhar/mpt-headers -``` ## macOS wheels @@ -206,15 +186,6 @@ bash packaging/python/test_wheels.sh python3.9 "-i https://test.pypi.org/simple/ On MacOS, launching `nrniv -python` or `special -python` can fail to load `neuron` module due to security restrictions. For this specific purpose, please `export SKIP_EMBEDED_PYTHON_TEST=true` before launching the tests. -### Testing on BB5 -On BB5, we can test CPU wheels with: - -``` -salloc -A proj16 -N 1 --ntasks-per-node=4 -C "cpu" --time=1:00:00 -p interactive -module load unstable python -bash packaging/python/test_wheels.sh python3.9 wheelhouse/NEURON-7.8.0.236-cp39-cp39-manylinux1_x86_64.whl -``` - ## Publishing the wheels on Pypi via Azure ### Variables that drive PyPI upload diff --git a/packaging/python/README.md b/packaging/python/README.md deleted file mode 120000 index 2529b5ed57..0000000000 --- a/packaging/python/README.md +++ /dev/null @@ -1 +0,0 @@ -../../docs/install/python_wheels.md \ No newline at end of file diff --git a/packaging/python/README.md b/packaging/python/README.md new file mode 100644 index 0000000000..7b7e1fc82b --- /dev/null +++ b/packaging/python/README.md @@ -0,0 +1 @@ +Refer to [this document](../../docs/install/python_wheels.md) to see how to build Python wheels for NEURON. From e95b63fa55fc1948784f50c81bbb207e2d88e14d Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 15 Nov 2024 11:27:45 +0100 Subject: [PATCH 11/30] Add CI for building wheels on MacOS on arm64 --- .github/workflows/wheels.yml | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/wheels.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000000..5ea343ac62 --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,89 @@ +name: Build NEURON Python wheels + +on: + push: + branches: + - master + pull_request: + branches: + - master + + workflow_dispatch: + inputs: + rel_release: + description: Release branch/commit + default: 'release/x.y' + required: true + rel_version: + description: Release version (tag name) + default: 'x.y.z' + required: true + + +jobs: + build-test: + name: Build Python wheels + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: [macos-14] + python-version: ['3.9', '3.10', '3.11', '3.12'] + + steps: + - name: Check out code + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v4 + + - name: Check out code for release + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v4 + with: + ref: ${{ github.inputs.rel_release }} + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install MacOS System Dependencies + if: startsWith(runner.os, 'macOS') + run: | + brew install --cask xquartz + brew install flex bison mpich + brew unlink mpich && brew install openmpi + cmake --version + # Uninstall libomp for compatibility with issue #817 + brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" + brew install cmake + echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH + echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + + - name: Install readline + if: startsWith(runner.os, 'macOS') + run: | + sudo mkdir -p /opt/nrnwheel/$(uname -m) + sudo bash packaging/python/build_static_readline_osx.bash + + - name: Set env for release + if: github.event_name == 'workflow_dispatch' + run: | + echo "NRN_NIGHTLY_UPLOAD=false" >> $GITHUB_ENV + echo NRN_RELEASE_UPLOAD=${{ github.event.inputs.upload }} >> $GITHUB_ENV + echo "NEURON_NIGHTLY_TAG=" >> $GITHUB_ENV + echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV + + - name: Build wheels on MacOS + if: startsWith(runner.os, 'macOS') + run: | + packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron + + - name: Test wheel + run: | + minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + + - name: Upload wheel files + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.python-version }} + path: wheelhouse/*.whl From 1e0293f34635c9a37d33648b123dcc9abe3cb641 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 18 Nov 2024 11:29:31 +0100 Subject: [PATCH 12/30] Add merging of artifacts to wheel CI job --- .github/workflows/wheels.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5ea343ac62..9b68726211 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -87,3 +87,13 @@ jobs: with: name: wheels-${{ matrix.python-version }} path: wheelhouse/*.whl + + merge: + runs-on: ubuntu-latest + needs: build-test + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@v4 + with: + delete-merged: true + name: wheels From 4bc8e31211e236451cc1fff808bcdd75d24168c8 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Mon, 18 Nov 2024 12:20:42 +0100 Subject: [PATCH 13/30] Add `pattern: wheels-*` to merge job in CI --- .github/workflows/wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9b68726211..61c6b7a7ff 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -97,3 +97,4 @@ jobs: with: delete-merged: true name: wheels + pattern: wheels-* From 1a8e34405f4d8296d385ca044fd96e38a213745d Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 19 Nov 2024 11:55:38 +0100 Subject: [PATCH 14/30] Append `matrix.os` to artifact name --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 61c6b7a7ff..8f2e9123d1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -85,7 +85,7 @@ jobs: - name: Upload wheel files uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.python-version }} + name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl merge: From c8b9277f302164bc107abe623030cece34da1183 Mon Sep 17 00:00:00 2001 From: JCGoran Date: Thu, 5 Dec 2024 14:59:13 +0100 Subject: [PATCH 15/30] Update .github/workflows/wheels.yml --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 8f2e9123d1..e44967e0a8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: os: [macos-14] - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Check out code From f461d85ee984508157e391d9d799ffd44a2764a8 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 09:46:25 +0100 Subject: [PATCH 16/30] Add other configs to CI --- .github/workflows/wheels.yml | 57 ++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e44967e0a8..1a0c3ceca0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,25 +21,28 @@ on: jobs: - build-test: - name: Build Python wheels + build-test-macos: + name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: matrix: - os: [macos-14] + os: [macos-13, macos-14] python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Check out code if: github.event_name != 'workflow_dispatch' uses: actions/checkout@v4 + with: + submodules: recursive - name: Check out code for release if: github.event_name == 'workflow_dispatch' uses: actions/checkout@v4 with: ref: ${{ github.inputs.rel_release }} + submodules: recursive - uses: actions/setup-python@v5 with: @@ -79,8 +82,52 @@ jobs: - name: Test wheel run: | - minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl + + - name: Upload wheel files + uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.python-version }}-${{ matrix.os }} + path: wheelhouse/*.whl + + + build-test-linux: + name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + container: ${{ matrix.base_image }} + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + include: + - os: 'ubuntu-22.04' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' + - os: 'ubuntu-22.04-arm' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' + + steps: + - name: Check out code + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Check out code for release + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v4 + with: + ref: ${{ github.inputs.rel_release }} + submodules: recursive + + - name: Build Manylinux wheel + run: | + packaging/python/build_wheels.bash linux ${{ matrix.python-version }} coreneuron + + - name: Test wheel + run: | + minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl - name: Upload wheel files uses: actions/upload-artifact@v4 From cbeb0ce695fe7fc826b76f2894635e1cca8468bb Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 11:11:18 +0100 Subject: [PATCH 17/30] Remove azure and circleCI --- .circleci/config.yml | 98 ----------------------- azure-pipelines.yml | 180 ------------------------------------------- 2 files changed, 278 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 azure-pipelines.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b7269b66ee..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2.1 - -orbs: - python: circleci/python@3.0.0 - -jobs: - manylinux_2_28-aarch64: - - parameters: - NRN_PYTHON_VERSION_MINOR: - type: string - NRN_NIGHTLY_UPLOAD: - type: string - - machine: - image: default - - resource_class: arm.medium - - steps: - - checkout - - run: - name: Build manylinux AArch64 wheel - command: | - docker run --rm \ - -w /root/nrn \ - -v $PWD:/root/nrn \ - -v /opt/nrnwheel/mpt:/nrnwheel/mpt \ - -e NEURON_NIGHTLY_TAG \ - -e NRN_NIGHTLY_UPLOAD \ - -e NRN_RELEASE_UPLOAD \ - -e SETUPTOOLS_SCM_PRETEND_VERSION \ - -e NRN_BUILD_FOR_UPLOAD=1 \ - 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' \ - packaging/python/build_wheels.bash linux 3<< parameters.NRN_PYTHON_VERSION_MINOR >> coreneuron - - - store_artifacts: - path: ./wheelhouse - destination: artifacts - - - run: - name: Test manylinux AArch64 wheel - command: | - sudo apt purge -y needrestart - sudo apt update - echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/deadsnakes-ppa.list && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 && sudo apt update - sudo apt update - # install mpi dependencies - sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev - version=3.<< parameters.NRN_PYTHON_VERSION_MINOR >> - # install Python from deadsnakes - sudo apt install -y python${version}-venv libpython${version}-dev g++ make - - export PYTHON_EXE=$(which python3.<< parameters.NRN_PYTHON_VERSION_MINOR >>) - - # test wheel - packaging/python/test_wheels.sh $PYTHON_EXE $(ls -t wheelhouse/*.whl) - - - run: - name: Upload nightly wheel to pypi.org - command: | - if [ "<< parameters.NRN_NIGHTLY_UPLOAD >>" == "true" ]; then - python -m pip install --upgrade pip - python -m pip install twine - python -m twine upload --verbose --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD wheelhouse/*.whl - else - echo "Skipping pypi.org upload!" - fi - -workflows: - - build-workflow: - jobs: - - manylinux_2_28-aarch64: - filters: - branches: - only: - - /release\/.*/ - - /circleci\/.*/ - matrix: - parameters: - NRN_PYTHON_VERSION_MINOR: ["13"] - NRN_NIGHTLY_UPLOAD: ["false"] - - nightly: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - jobs: - - manylinux_2_28-aarch64: - matrix: - parameters: - NRN_PYTHON_VERSION_MINOR: ["9", "10", "11", "12", "13"] - NRN_NIGHTLY_UPLOAD: ["true"] diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index a081844ac0..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,180 +0,0 @@ -#============================================================================= -# Azure Pipeline settings -#============================================================================= - -# Nightly build master for pypi upload -schedules: -- cron: "0 0 * * *" - branches: - include: - - master - always: true - -# Auto cancel old PR builds -pr: - autoCancel: true -# TODO : https://github.com/neuronsimulator/nrn/issues/1063 -# paths: -# exclude: -# - docs -# - README.md - -# Trigger build for certain branches only -trigger: -- master -- release/* - -stages: - - stage: BuildTestDeploy - jobs: - - - job: 'ManyLinuxWheels' - timeoutInMinutes: 45 - pool: - vmImage: 'ubuntu-20.04' - strategy: - matrix: - Python39: - python.version: '3.9' - Python310: - python.version: '3.10' - Python311: - python.version: '3.11' - Python312: - python.version: '3.12' - Python313: - python.version: '3.13' - - steps: - - # Secure files documentation: - # https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops - # NOTE: when uploading new secure files, access must be permitted from the Azure pipeline interface (check message there) - - task: DownloadSecureFile@1 - name: mpt_headersSF - displayName: 'Download mpt_headers secure file' - inputs: - secureFile: 'mpt_headears.2.21.tar.gz' - - # Note that mpt headers must be mounted in the docker imager under `/nrnwheel/mpt` - # This path is checked by `packaging/python/build_wheels.bash` when run in the image. - - script: | - sudo mkdir -p /opt/nrnwheel/mpt - sudo tar -zxf $(mpt_headersSF.secureFilePath) --directory /opt/nrnwheel/mpt - docker run --rm \ - -w /root/nrn \ - -v $PWD:/root/nrn \ - -v /opt/nrnwheel/mpt:/nrnwheel/mpt \ - -e NEURON_NIGHTLY_TAG \ - -e NRN_NIGHTLY_UPLOAD \ - -e NRN_RELEASE_UPLOAD \ - -e SETUPTOOLS_SCM_PRETEND_VERSION \ - -e NRN_BUILD_FOR_UPLOAD=1 \ - 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' \ - packaging/python/build_wheels.bash linux $(python.version) coreneuron - displayName: 'Building ManyLinux Wheel' - - - script: | - sudo apt update - sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev - displayName: 'Install Test System Dependencies' - - - template: ci/azure-wheel-test-upload.yml - - - # Jobs to build OSX wheels natively - - job: 'MacOSWheels' - timeoutInMinutes: 60 - pool: - vmImage: 'macOS-13' - strategy: - matrix: - Python39: - python.version: '3.9' - python.org.version: '3.9.13' - python.installer.name: 'macos11.pkg' - Python310: - python.version: '3.10' - python.org.version: '3.10.11' - python.installer.name: 'macos11.pkg' - Python311: - python.version: '3.11' - python.org.version: '3.11.7' - python.installer.name: 'macos11.pkg' - Python312: - python.version: '3.12' - python.org.version: '3.12.0' - python.installer.name: 'macos11.pkg' - Python313: - python.version: '3.13' - python.org.version: '3.13.0' - python.installer.name: 'macos11.pkg' - - steps: - - - script: | - installer=python-$(python.org.version)-$(python.installer.name) - url=https://www.python.org/ftp/python/$(python.org.version)/$installer - curl $url -o $installer - sudo installer -pkg $installer -target / - displayName: 'Install Python from python.org' - - - script: | - brew install --cask xquartz - brew install flex bison mpich - brew unlink mpich && brew install openmpi - cmake --version - # see https://github.com/BlueBrain/CoreNeuron/issues/817, uninstall libomp until we fix this - # as we are building wheels, we shouldn't enable OpenMP here anyway - brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" - displayName: 'Install OSX System Dependencies' - - # readline has been manually built with ncurses and MACOSX_DEPLOYMENT_TARGET=10.9 and stored as secure file on Azure. - # See `packaging/python/Dockerfile` for build instructions. - # - # Secure files documentation: - # https://docs.microsoft.com/en-us/azure/devops/pipelines/library/secure-files?view=azure-devops - # NOTE: when uploading new secure files, access must be permitted from the Azure pipeline interface (check message there) - - task: DownloadSecureFile@1 - name: readlineSF - displayName: 'Download readline secure file' - inputs: - secureFile: 'readline7.0-ncurses6.4.tar.gz' - - # 10.14 is required for full C++17 support according to - # https://cibuildwheel.readthedocs.io/en/stable/cpp_standards, but it - # seems that 10.15 is actually needed for std::filesystem::path. - - script: | - export MACOSX_DEPLOYMENT_TARGET=10.15 - 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 -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' - - - template: ci/azure-wheel-test-upload.yml - - - - stage: Final - jobs: - - job: AzureDropURL - pool: - vmImage: 'ubuntu-20.04' - condition: eq(variables['Build.Reason'], 'PullRequest') - steps: - - checkout: none - - script: | - export AZURE_DROP_URL=`curl -v 'https://dev.azure.com/neuronsimulator/nrn/_apis/build/builds/$(Build.BuildId)/artifacts?artifactName=drop' | jq -r '.resource.downloadUrl'` - echo "Setting dropurl to $AZURE_DROP_URL" - echo "##vso[task.setvariable variable=dropurl]$AZURE_DROP_URL" - displayName: 'Resolve Azure drop URL' - - - task: GitHubComment@0 - continueOnError: true - inputs: - gitHubConnection: 'neuronsimulator' - repositoryName: '$(Build.Repository.Name)' - comment: | - ✔️ $(system.pullRequest.sourceCommitId) -> [Azure artifacts URL]($(dropurl)) From 14f925d8055ad7ee9a1aa5bb5657c8cbb78130d1 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 10:21:21 +0100 Subject: [PATCH 18/30] Fix CI issue --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1a0c3ceca0..4f484690ad 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -137,7 +137,7 @@ jobs: merge: runs-on: ubuntu-latest - needs: build-test + needs: [build-test-macos, build-test-linux] steps: - name: Merge Artifacts uses: actions/upload-artifact/merge@v4 From bb8ac5847d4ff07e159453a2ab343a9c5293f421 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 10:53:10 +0100 Subject: [PATCH 19/30] Do not use git shenanigans when building wheels --- packaging/python/build_wheels.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/packaging/python/build_wheels.bash b/packaging/python/build_wheels.bash index c022bdec7f..5c53f0d61b 100755 --- a/packaging/python/build_wheels.bash +++ b/packaging/python/build_wheels.bash @@ -30,8 +30,6 @@ py_ver="" python_requirements_path="$(mktemp -d)/requirements.txt" clone_nmodl_and_add_requirements() { - git config --global --add safe.directory /root/nrn - git submodule update --init --recursive --force --depth 1 -- external/nmodl # We only want the _build_ dependencies sed -e '/^# runtime dependencies/,$ d' external/nmodl/requirements.txt >> "${python_requirements_path}" } From de7d05764dcec37ccd10adc9e9ff70d73b3dfd74 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 10:58:43 +0100 Subject: [PATCH 20/30] Try normal Python on MacOS --- .github/workflows/wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 4f484690ad..513d7f87ef 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -82,8 +82,8 @@ jobs: - name: Test wheel run: | - minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl + minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - name: Upload wheel files uses: actions/upload-artifact@v4 @@ -126,8 +126,8 @@ jobs: - name: Test wheel run: | - minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl + minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - name: Upload wheel files uses: actions/upload-artifact@v4 From dcfb8a1e322a683aa7b9117bce2456ab38c8b103 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 11:56:50 +0100 Subject: [PATCH 21/30] Minor fixes --- .github/workflows/wheels.yml | 46 +++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 513d7f87ef..1d33dc3ab6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -28,7 +28,26 @@ jobs: strategy: matrix: os: [macos-13, macos-14] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + include: + - python-version: '3.9' + python.org.version: '3.9.13' + python.installer.name: 'macos11.pkg' + + #- python-version: '3.10' + # python.org.version: '3.10.11' + # python.installer.name: 'macos11.pkg' + + #- python-version: '3.11' + # python.org.version: '3.11.7' + # python.installer.name: 'macos11.pkg' + + #- python-version: '3.12' + # python.org.version: '3.12.0' + # python.installer.name: 'macos11.pkg' + + - python-version: '3.13' + python.org.version: '3.13.0' + python.installer.name: 'macos11.pkg' steps: - name: Check out code @@ -44,25 +63,24 @@ jobs: ref: ${{ github.inputs.rel_release }} submodules: recursive - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Install Python from python.org + run: | + installer=python-${{ matrix.python.org.version }}-${{ matrix.python.installer.name }} + url="https://www.python.org/ftp/python/${{ matrix.python.org.version }}/${installer} + curl $url -o $installer + sudo installer -pkg $installer -target / - - name: Install MacOS System Dependencies - if: startsWith(runner.os, 'macOS') + - name: Install System Dependencies run: | brew install --cask xquartz - brew install flex bison mpich + brew install flex bison cmake mpich brew unlink mpich && brew install openmpi cmake --version # Uninstall libomp for compatibility with issue #817 brew uninstall --ignore-dependencies libomp || echo "libomp doesn't exist" - brew install cmake - echo "$(brew --prefix)/opt/cmake/bin" >> $GITHUB_PATH - echo "$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH + echo "$(brew --prefix)/opt/cmake/bin:$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - name: Install readline - if: startsWith(runner.os, 'macOS') run: | sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash @@ -99,7 +117,7 @@ jobs: container: ${{ matrix.base_image }} strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.13'] include: - os: 'ubuntu-22.04' base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' @@ -126,8 +144,8 @@ jobs: - name: Test wheel run: | - minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl + minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl - name: Upload wheel files uses: actions/upload-artifact@v4 From 3481ccbe317ed5d4e7d85ec2e732b8e139fdca1c Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 12:02:05 +0100 Subject: [PATCH 22/30] Typo --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1d33dc3ab6..c8eb0241d1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -66,7 +66,7 @@ jobs: - name: Install Python from python.org run: | installer=python-${{ matrix.python.org.version }}-${{ matrix.python.installer.name }} - url="https://www.python.org/ftp/python/${{ matrix.python.org.version }}/${installer} + url="https://www.python.org/ftp/python/${{ matrix.python.org.version }}/${installer}" curl $url -o $installer sudo installer -pkg $installer -target / From 3acfbe55f471bb4897fcccddbaac4c35ef4ffd62 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 12:07:19 +0100 Subject: [PATCH 23/30] Maybe quotes? --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c8eb0241d1..eecfd90f85 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -65,7 +65,7 @@ jobs: - name: Install Python from python.org run: | - installer=python-${{ matrix.python.org.version }}-${{ matrix.python.installer.name }} + installer="python-${{ matrix.python.org.version }}-${{ matrix.python.installer.name }}" url="https://www.python.org/ftp/python/${{ matrix.python.org.version }}/${installer}" curl $url -o $installer sudo installer -pkg $installer -target / From 9f41e67da857e52a2e5cde5ba62dc0d264fb8369 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 12:10:27 +0100 Subject: [PATCH 24/30] Maybe dots are the problem --- .github/workflows/wheels.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index eecfd90f85..1720bca132 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -30,8 +30,8 @@ jobs: os: [macos-13, macos-14] include: - python-version: '3.9' - python.org.version: '3.9.13' - python.installer.name: 'macos11.pkg' + python-org-version: '3.9.13' + python-installer-name: 'macos11.pkg' #- python-version: '3.10' # python.org.version: '3.10.11' @@ -46,8 +46,8 @@ jobs: # python.installer.name: 'macos11.pkg' - python-version: '3.13' - python.org.version: '3.13.0' - python.installer.name: 'macos11.pkg' + python-org-version: '3.13.0' + python-installer-name: 'macos11.pkg' steps: - name: Check out code @@ -65,8 +65,8 @@ jobs: - name: Install Python from python.org run: | - installer="python-${{ matrix.python.org.version }}-${{ matrix.python.installer.name }}" - url="https://www.python.org/ftp/python/${{ matrix.python.org.version }}/${installer}" + installer="python-${{ matrix.python-org-version }}-${{ matrix.python-installer-name }}" + url="https://www.python.org/ftp/python/${{ matrix.python-org-version }}/${installer}" curl $url -o $installer sudo installer -pkg $installer -target / From 9303ff681917048f6e01f20e08692e5034b3aeaf Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 12:41:15 +0100 Subject: [PATCH 25/30] Separate build and test steps --- .github/workflows/wheels.yml | 98 ++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 27 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 1720bca132..e8d3927d83 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,30 +21,19 @@ on: jobs: - build-test-macos: + build-macos: name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: matrix: os: [macos-13, macos-14] + python-version: ['3.9', '3.13'] include: - python-version: '3.9' python-org-version: '3.9.13' python-installer-name: 'macos11.pkg' - #- python-version: '3.10' - # python.org.version: '3.10.11' - # python.installer.name: 'macos11.pkg' - - #- python-version: '3.11' - # python.org.version: '3.11.7' - # python.installer.name: 'macos11.pkg' - - #- python-version: '3.12' - # python.org.version: '3.12.0' - # python.installer.name: 'macos11.pkg' - - python-version: '3.13' python-org-version: '3.13.0' python-installer-name: 'macos11.pkg' @@ -93,30 +82,47 @@ jobs: echo "NEURON_NIGHTLY_TAG=" >> $GITHUB_ENV echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - - name: Build wheels on MacOS - if: startsWith(runner.os, 'macOS') + - name: Build wheel run: | packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron - - name: Test wheel - run: | - minor_version="$(python -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python) wheelhouse/*cp3${minor_version}*.whl - - name: Upload wheel files uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl + test-macos: + name: Test MacOS wheel with ${{ matrix.python-version }} + needs: build-macos + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: ['macos-13', 'macos-14'] + python-version: ['3.9', '3.13'] + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Get wheel + uses: actions/download-artifact@v4 - build-test-linux: + - name: Test wheel with ${{ matrix.python-version }} + run: | + minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl + + build-linux: name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 container: ${{ matrix.base_image }} strategy: matrix: + os: ['ubuntu-22.04', 'ubuntu-22.04-arm'] python-version: ['3.9', '3.13'] include: - os: 'ubuntu-22.04' @@ -142,20 +148,43 @@ jobs: run: | packaging/python/build_wheels.bash linux ${{ matrix.python-version }} coreneuron - - name: Test wheel - run: | - minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl - - name: Upload wheel files uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl + test-linux: + name: Test manylinux wheel + needs: build-linux + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: ['ubuntu-22.04', 'ubuntu-22.04-arm'] + python-version: ['3.9', '3.13'] + include: + - os: 'ubuntu-22.04' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' + - os: 'ubuntu-22.04-arm' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' + + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Get wheel + uses: actions/download-artifact@v4 + + - name: Test wheel with ${{ matrix.python-version }} + run: | + minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" + packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl + merge: runs-on: ubuntu-latest - needs: [build-test-macos, build-test-linux] + needs: [build-macos, build-linux] steps: - name: Merge Artifacts uses: actions/upload-artifact/merge@v4 @@ -163,3 +192,18 @@ jobs: delete-merged: true name: wheels pattern: wheels-* + + final: + name: Final CI + needs: [build-macos, test-macos, build-linux, test-linux, merge] + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Check if CI matrix is successful + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + }} + run: exit 1 From 30c69a22610c74a0e647d2cf9fdfadffe66a750e Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 12:43:00 +0100 Subject: [PATCH 26/30] Forgot steps --- .github/workflows/wheels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e8d3927d83..25b5d814e7 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -102,6 +102,7 @@ jobs: os: ['macos-13', 'macos-14'] python-version: ['3.9', '3.13'] + steps: - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -169,6 +170,7 @@ jobs: - os: 'ubuntu-22.04-arm' base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' + steps: - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: From d1ace17063c568eda17bfc378b14811df6701980 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 13:20:31 +0100 Subject: [PATCH 27/30] Revert back to testing after build --- .github/workflows/wheels.yml | 69 +++++++++++++----------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 25b5d814e7..15afb45158 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,8 +21,8 @@ on: jobs: - build-macos: - name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} + build-test-macos: + name: Build and test Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: @@ -92,32 +92,13 @@ jobs: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl - test-macos: - name: Test MacOS wheel with ${{ matrix.python-version }} - needs: build-macos - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - strategy: - matrix: - os: ['macos-13', 'macos-14'] - python-version: ['3.9', '3.13'] - - steps: - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Get wheel - uses: actions/download-artifact@v4 - - name: Test wheel with ${{ matrix.python-version }} run: | minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl - build-linux: - name: Build Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} + build-test-linux: + name: Build and test Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 container: ${{ matrix.base_image }} @@ -147,7 +128,16 @@ jobs: - name: Build Manylinux wheel run: | - packaging/python/build_wheels.bash linux ${{ matrix.python-version }} coreneuron + docker run --rm \ + -w /root/nrn \ + -v $(pwd):/root/nrn \ + -e NEURON_NIGHTLY_TAG \ + -e NRN_NIGHTLY_UPLOAD \ + -e NRN_RELEASE_UPLOAD \ + -e SETUPTOOLS_SCM_PRETEND_VERSION \ + -e NRN_BUILD_FOR_UPLOAD=1 \ + ${{ matrix.base_image }} \ + packaging/python/build_wheels.bash linux ${{ matrix.python-version }} coreneuron - name: Upload wheel files uses: actions/upload-artifact@v4 @@ -155,38 +145,20 @@ jobs: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl - test-linux: - name: Test manylinux wheel - needs: build-linux - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - strategy: - matrix: - os: ['ubuntu-22.04', 'ubuntu-22.04-arm'] - python-version: ['3.9', '3.13'] - include: - - os: 'ubuntu-22.04' - base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' - - os: 'ubuntu-22.04-arm' - base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' - - steps: - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Get wheel - uses: actions/download-artifact@v4 - - name: Test wheel with ${{ matrix.python-version }} run: | minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl merge: + name: Merge artifacts runs-on: ubuntu-latest - needs: [build-macos, build-linux] + needs: [build-test-macos, build-test-linux] steps: - name: Merge Artifacts uses: actions/upload-artifact/merge@v4 @@ -195,9 +167,16 @@ jobs: name: wheels pattern: wheels-* + upload: + name: Upload wheels + needs: merge + steps: + - name: Upload wheels + run: echo "TODO" + final: name: Final CI - needs: [build-macos, test-macos, build-linux, test-linux, merge] + needs: [merge] if: ${{ always() }} runs-on: ubuntu-latest steps: From 3e1817cc4d4c4424cf811b55d37cbdb072845439 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 13:21:32 +0100 Subject: [PATCH 28/30] Fix missing property --- .github/workflows/wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 15afb45158..38c9f5b378 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -169,6 +169,7 @@ jobs: upload: name: Upload wheels + runs-on: ubuntu-latest needs: merge steps: - name: Upload wheels From 75a30b9e9bd487fdf98096a612fa5d3f996904e9 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 13:24:04 +0100 Subject: [PATCH 29/30] Remove container --- .github/workflows/wheels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 38c9f5b378..ecd99a4649 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -101,7 +101,6 @@ jobs: name: Build and test Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 - container: ${{ matrix.base_image }} strategy: matrix: os: ['ubuntu-22.04', 'ubuntu-22.04-arm'] From 5ada0ee1e4c945d39e902743bca8ac8943a24f63 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Tue, 28 Jan 2025 13:34:10 +0100 Subject: [PATCH 30/30] Merge into one big job --- .github/workflows/wheels.yml | 64 ++++++++++++------------------------ 1 file changed, 21 insertions(+), 43 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ecd99a4649..a61d7475c5 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,13 +21,13 @@ on: jobs: - build-test-macos: + build-test: name: Build and test Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: matrix: - os: [macos-13, macos-14] + os: ['macos-13', 'macos-14', 'ubuntu-22.04', 'ubuntu-22.04-arm'] python-version: ['3.9', '3.13'] include: - python-version: '3.9' @@ -38,6 +38,12 @@ jobs: python-org-version: '3.13.0' python-installer-name: 'macos11.pkg' + - os: 'ubuntu-22.04' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' + + - os: 'ubuntu-22.04-arm' + base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' + steps: - name: Check out code if: github.event_name != 'workflow_dispatch' @@ -53,6 +59,7 @@ jobs: submodules: recursive - name: Install Python from python.org + if: runner.os == 'macOS' run: | installer="python-${{ matrix.python-org-version }}-${{ matrix.python-installer-name }}" url="https://www.python.org/ftp/python/${{ matrix.python-org-version }}/${installer}" @@ -60,6 +67,7 @@ jobs: sudo installer -pkg $installer -target / - name: Install System Dependencies + if: runner.os == 'macOS' run: | brew install --cask xquartz brew install flex bison cmake mpich @@ -70,6 +78,7 @@ jobs: echo "$(brew --prefix)/opt/cmake/bin:$(brew --prefix)/opt/flex/bin:$(brew --prefix)/opt/bison/bin" >> $GITHUB_PATH - name: Install readline + if: runner.os == 'macOS' run: | sudo mkdir -p /opt/nrnwheel/$(uname -m) sudo bash packaging/python/build_static_readline_osx.bash @@ -83,49 +92,12 @@ jobs: echo SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.rel_version }} >> $GITHUB_ENV - name: Build wheel + if: runner.os == 'macOS' run: | packaging/python/build_wheels.bash osx ${{ matrix.python-version }} coreneuron - - name: Upload wheel files - uses: actions/upload-artifact@v4 - with: - name: wheels-${{ matrix.python-version }}-${{ matrix.os }} - path: wheelhouse/*.whl - - - name: Test wheel with ${{ matrix.python-version }} - run: | - minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" - packaging/python/test_wheels.sh $(which python${{ matrix.python-version }}) wheelhouse/*cp3${minor_version}*.whl - - build-test-linux: - name: Build and test Python ${{ matrix.python-version }} wheel on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - strategy: - matrix: - os: ['ubuntu-22.04', 'ubuntu-22.04-arm'] - python-version: ['3.9', '3.13'] - include: - - os: 'ubuntu-22.04' - base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_x86_64' - - os: 'ubuntu-22.04-arm' - base_image: 'docker.io/neuronsimulator/neuron_wheel:manylinux_2_28_aarch64' - - steps: - - name: Check out code - if: github.event_name != 'workflow_dispatch' - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Check out code for release - if: github.event_name == 'workflow_dispatch' - uses: actions/checkout@v4 - with: - ref: ${{ github.inputs.rel_release }} - submodules: recursive - - name: Build Manylinux wheel + if: runner.os != 'macOS' run: | docker run --rm \ -w /root/nrn \ @@ -144,11 +116,17 @@ jobs: name: wheels-${{ matrix.python-version }}-${{ matrix.os }} path: wheelhouse/*.whl - - name: Setup Python ${{ matrix.python-version }} + - name: Setup Python ${{ matrix.python-version }} for testing uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install test dependencies + if: runner.os != 'macOS' + run: | + sudo apt update + sudo apt install -y mpich openmpi-bin libopenmpi-dev libmpich-dev + - name: Test wheel with ${{ matrix.python-version }} run: | minor_version="$(python${{ matrix.python-version }} -c 'import sys;print(sys.version_info.minor)')" @@ -157,7 +135,7 @@ jobs: merge: name: Merge artifacts runs-on: ubuntu-latest - needs: [build-test-macos, build-test-linux] + needs: [build-test] steps: - name: Merge Artifacts uses: actions/upload-artifact/merge@v4