Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mem/trim-gpu-alloca…
Browse files Browse the repository at this point in the history
…tion-even-more
  • Loading branch information
thorstenhater committed Oct 10, 2024
2 parents 61ed2a0 + bca8a5a commit 4e8aebc
Show file tree
Hide file tree
Showing 153 changed files with 226,249 additions and 3,226 deletions.
25 changes: 0 additions & 25 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arbor/include/git-source-id text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_MPI=OFF
ninja -j4 ubenches
cd -
- name: Run benchmarks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=ON -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=ON -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=OFF -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
make -j4 tests examples pyarb
cd -
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ jobs:
- name: Get packages
run: |
python -m pip install --upgrade pip
pip install flake8
pip install ruff
- name: Clone w/ submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Python Formatting
uses: psf/black@stable
with:
options: --check --extend-exclude '/(ext|doc/scripts/.*_theme|doc/scripts/inputs.py)'
src: .
- name: Python analysis
run: |
flake8 .
ruff check --output-format=github .
- name: Python formatting
run: |
ruff format --check .
5 changes: 4 additions & 1 deletion .github/workflows/sanitize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches: [ master ]
paths-ignore: 'doc/**'

pull_request:
branches: [ master ]

schedule:
- cron: '0 2 * * 0' # run at 2 AM every sunday

Expand Down Expand Up @@ -61,7 +64,7 @@ jobs:
mkdir build
cd build
export SAN="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer"
cmake .. -GNinja -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="$SAN" -DCMAKE_C_FLAGS="$SAN" -DCMAKE_EXE_LINKER_FLAGS="$SAN" -DCMAKE_MODULE_LINKER_FLAGS="$SAN" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_VECTORIZE=${{ matrix.simd }} -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
cmake .. -GNinja -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="$SAN" -DCMAKE_C_FLAGS="$SAN" -DCMAKE_EXE_LINKER_FLAGS="$SAN" -DCMAKE_MODULE_LINKER_FLAGS="$SAN" -DARB_WITH_ASSERTIONS=ON -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_VECTORIZE=${{ matrix.simd }} -DARB_WITH_MPI=OFF -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
ninja -j4 -v tests examples pyarb
cd -
- name: Run unit tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python` -DARB_USE_BUNDLED_LIBS=ON
cmake .. -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
make html
7 changes: 4 additions & 3 deletions .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
name: "CMake Matrix Test."
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
Expand All @@ -37,7 +38,7 @@ jobs:
}
- {
name: "MacOS Min",
os: "macos-12",
os: "macos-13",
cc: "clang",
cxx: "clang++",
py: "3.9",
Expand Down Expand Up @@ -153,7 +154,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir build
cd build
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
ninja -j4 tests examples pyarb
cd -
- if: ${{ matrix.variant == 'shared' }}
Expand All @@ -162,7 +163,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir build
cd build
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DBUILD_SHARED_LIBS=ON -DARB_WITH_PROFILING=ON
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_WITH_ASSERTIONS=ON -DBUILD_SHARED_LIBS=ON -DARB_WITH_PROFILING=ON
ninja -j4 tests examples pyarb
cd -
- name: Install arbor
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Build and install Arbor using pip + build flags
run: |
source ~/env/bin/activate
CMAKE_ARGS="-DARB_VECTORIZE=ON -DARB_ARCH=native" pip install .
CMAKE_ARGS="-DARB_VECTORIZE=ON -DARB_ARCH=native" pip -vvv install .
- name: Check that build flags match
run: |
source ~/env/bin/activate
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ _skbuild

# generated by test scripts
results
/_deps/
122 changes: 122 additions & 0 deletions .gitlab/cscs-ci-default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
include:
- remote: 'https://gitlab.com/cscs-ci/recipes/-/raw/master/templates/v2/.ci-ext.yml'

stages:
- build_base
- build_app
- build_multiarch
- test

# TARGET must be any of {daint-gpu daint-mc alps-zen2 alps-a100 alps-mi200 alps-gh200 alps-mi300a}
# eiger: 2x AMD EPYC 7742 64-Core, micro-arch: zen2
# todi: 4x gh200 72-Core + H100, micro-arch: neoverse-v2, cuda-arch: 90

build_base_image_x86_64:
extends: [.container-builder-cscs-zen2, .dynamic-image-name]
stage: build_base
variables:
DOCKERFILE: .gitlab/docker/Dockerfile.base
WATCH_FILECHANGES: '.gitlab/docker/Dockerfile.base'
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/arbor/baseimg-x86_64
CSCS_BUILD_IN_MEMORY: TRUE
CSCS_REBUILD_POLICY: "if-not-exists"
DOCKER_BUILD_ARGS: '["IMG_BASE=ghcr.io/eth-cscs/docker-ci-ext/base-containers/spack-base:spack0.21.0-ubuntu22.04-cpu", "IMG_HELPER=ghcr.io/eth-cscs/docker-ci-ext/base-containers/spack-helper:ubuntu22.04-cpu", "TARGET=alps-zen2"]'

build_base_image_aarch64:
extends: [.container-builder-cscs-gh200, .dynamic-image-name]
stage: build_base
variables:
DOCKERFILE: .gitlab/docker/Dockerfile.base
WATCH_FILECHANGES: '.gitlab/docker/Dockerfile.base'
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/arbor/baseimg-aarch64
CSCS_BUILD_IN_MEMORY: TRUE
CSCS_REBUILD_POLICY: "if-not-exists"
DOCKER_BUILD_ARGS: '["IMG_BASE=ghcr.io/eth-cscs/docker-ci-ext/base-containers/spack-base:spack0.21.0-ubuntu22.04-cuda12.4.1", "IMG_HELPER=ghcr.io/eth-cscs/docker-ci-ext/base-containers/spack-helper:ubuntu22.04-cuda12.4.1", "TARGET=alps-gh200"]'

build_app_image_x86_64:
extends: .container-builder-cscs-zen2
stage: build_app
needs:
- job: build_base_image_x86_64
artifacts: true
variables:
DOCKERFILE: .gitlab/docker/Dockerfile.app
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/arbor/appimg-x86_64:$CI_COMMIT_SHORT_SHA
DOCKER_BUILD_ARGS: '["BASE_IMAGE=$BASE_IMAGE", "CXX_FLAGS=-march=znver2"]'

build_app_image_aarch64:
extends: .container-builder-cscs-gh200
stage: build_app
needs:
- job: build_base_image_aarch64
artifacts: true
variables:
DOCKERFILE: .gitlab/docker/Dockerfile.app
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/arbor/appimg-aarch64:$CI_COMMIT_SHORT_SHA
DOCKER_BUILD_ARGS: '["BASE_IMAGE=$BASE_IMAGE", "CXX_FLAGS=-mcpu=neoverse-v2 -mtune=neoverse-v2", "GPU=cuda", "GPU_ARCH=90"]'

build_multiarch_image:
extends: .make-multiarch-image
stage: build_multiarch
variables:
PERSIST_IMAGE_NAME_X86_64: "$CSCS_REGISTRY_PATH/arbor/appimg-x86_64:$CI_COMMIT_SHORT_SHA"
PERSIST_IMAGE_NAME_AARCH64: "$CSCS_REGISTRY_PATH/arbor/appimg-aarch64:$CI_COMMIT_SHORT_SHA"
PERSIST_IMAGE_NAME: "$CSCS_REGISTRY_PATH/arbor/appimg:$CI_COMMIT_SHORT_SHA"

.test_unit:
stage: test
image: $CSCS_REGISTRY_PATH/arbor/appimg:$CI_COMMIT_SHORT_SHA
script:
- cd /arbor.src
- build/bin/unit-modcc
- build/bin/unit-local
- build/bin/unit
- scripts/run_cpp_examples.sh
- python -m venv --system-site-packages /arbor.install
- source /arbor.install/bin/activate
- python -m unittest discover -v -s python
- scripts/run_python_examples.sh
- scripts/test_executables.sh
- deactivate
variables:
SLURM_JOB_NUM_NODES: 1
SLURM_NTASKS: 1
SLURM_NTASKS_PER_NODE: 1
SLURM_TIMELIMIT: "00:30:00"
SLURM_CPU_BIND: "verbose,none"
USE_MPI: "NO"

test_x86_64:
extends: [.container-runner-eiger-mc, .test_unit]
variables:
SLURM_CONSTRAINT: mc

test_aarch64:
extends: [.container-runner-todi-gh200, .test_unit]

## distributed tests don't work yet - possible problem with the gitlab runners
#.test_distributed:
# stage: test
# image: $CSCS_REGISTRY_PATH/arbor/appimg:$CI_COMMIT_SHORT_SHA
# script:
# - cd /arbor.src
# - build/bin/unit-mpi
# - scripts/run_cpp_examples.sh -d
# variables:
# SLURM_JOB_NUM_NODES: 2
# SLURM_CPU_BIND: "verbose,rank_ldom"
# SLURM_TIMELIMIT: "00:30:00"
# USE_MPI: "YES"
#
#test_x86_64-distributed:
# extends: [.container-runner-eiger-mc, .test_distributed]
# variables:
# SLURM_CONSTRAINT: mc
# SLURM_NTASKS_PER_NODE: 8
#
#test_aarch64-distributed:
# extends: [.container-runner-todi-gh200, .test_distributed]
# variables:
# SLURM_GPUS_PER_NODE: 4
# SLURM_GPUS_PER_TASK: 1
# SLURM_NTASKS_PER_NODE: 4
32 changes: 32 additions & 0 deletions .gitlab/docker/Dockerfile.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE

COPY . /arbor.src

ARG NUM_PROCS
ARG CXX_FLAGS=""
ARG GPU=none
ARG GPU_ARCH=60

RUN echo ${CXX_FLAGS}

RUN mkdir -p /arbor.src/build \
&& cd /arbor.src/build \
&& cmake .. \
-GNinja \
-DCMAKE_INSTALL_PREFIX=/arbor.install \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DARB_ARCH=none \
-DARB_CXX_FLAGS_TARGET="${CXX_FLAGS}" \
-DARB_WITH_ASSERTIONS=ON \
-DARB_WITH_PROFILING=ON \
-DARB_VECTORIZE=ON \
-DARB_WITH_PYTHON=ON \
-DARB_USE_HWLOC=ON \
-DARB_WITH_MPI=ON \
-DARB_GPU=$GPU\
-DCMAKE_CUDA_ARCHITECTURES=$GPU_ARCH \
-DARB_USE_GPU_RNG=ON \
&& ninja -j${NUM_PROCS} tests examples pyarb \
&& ninja install
50 changes: 50 additions & 0 deletions .gitlab/docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ARG IMG_BASE
FROM $IMG_BASE as builder

ARG TARGET
RUN spack-install-helper --target $TARGET \
"git" \
"meson" \
"ninja" \
"cmake" \
"valgrind" \
"python" \
"hwloc" \
"boost" \
"fmt" \
"random123" \
"py-mpi4py" \
"py-sphinx" \
"py-svgwrite" \
"nlohmann-json" \
"py-pybind11" \
"py-numpy" \
"py-flake8" \
"py-black" \
"py-pytest" \
"py-seaborn" \
"py-pandas" \
"pugixml" \
"googletest"

# end of builder container, now we are ready to copy necessary files
# copy only relevant parts to the final container
ARG IMG_HELPER
FROM $IMG_HELPER

# it is important to keep the paths, otherwise your installation is broken
# all these paths are created with the above `spack-install-helper` invocation
COPY --from=builder /opt/spack-environment /opt/spack-environment
COPY --from=builder /opt/software /opt/software
COPY --from=builder /opt/._view /opt/._view
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh

# Some boilerplate to get all paths correctly - fix_spack_install is part of thebase image
# and makes sure that all important things are being correctly setup
RUN fix_spack_install

# Finally install software that is needed, e.g. compilers
# It is also possible to build compilers via spack and let all dependencies be handled by spack
RUN apt-get -yqq update && apt-get -yqq upgrade \
&& apt-get -yqq install build-essential gfortran \
&& rm -rf /var/lib/apt/lists/*
31 changes: 0 additions & 31 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,31 +0,0 @@
[submodule "google-benchmark"]
path = ext/google-benchmark
url = https://github.com/google/benchmark.git
branch = main
[submodule "ext/fmt"]
path = ext/fmt
url = https://github.com/fmtlib/fmt.git
branch = master
[submodule "ext/random123"]
path = ext/random123
url = https://github.com/DEShawResearch/random123.git
branch = main
[submodule "ext/json"]
path = ext/json
url = https://github.com/nlohmann/json.git
branch = master
[submodule "ext/pybind11"]
path = ext/pybind11
url = https://github.com/pybind/pybind11.git
branch = master
[submodule "ext/googletest"]
path = ext/googletest
url = https://github.com/google/googletest.git
branch = main
[submodule "ext/pugixml"]
path = ext/pugixml
url = https://github.com/zeux/pugixml.git
branch = master
[submodule "ext/units"]
path = ext/units
url = https://github.com/LLNL/units.git
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tasks:
mkdir build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H/workspace/arbor -B/workspace/arbor/build \
-DCMAKE_INSTALL_PREFIX:STRING=/workspace/arbor/install -DCMAKE_BUILD_TYPE:STRING=Debug -G "Unix Makefiles" \
-DARB_WITH_PYTHON:BOOL=ON -DARB_USE_BUNDLED_LIBS:BOOL=ON
-DARB_WITH_PYTHON:BOOL=ON
ln -s /workspace/arbor/build/compile_commands.json /workspace/arbor
export PYTHONPATH=/workspace/arbor/install/lib/python3.7/site-packages
prebuild: |
Expand Down
Loading

0 comments on commit 4e8aebc

Please sign in to comment.