Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FLAMEGPU/FLAMEGPU2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1f2fa9f1037256fb31d532a60bc7d05799e9ccb2
Choose a base ref
..
head repository: FLAMEGPU/FLAMEGPU2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4ea6196e1144c0b2a750ea0073c25fa7992029e5
Choose a head ref
Showing with 11,182 additions and 550 deletions.
  1. +261 −0 .github/workflows/MPI.yml
  2. +5 −0 .github/workflows/Ubuntu.yml
  3. +5 −0 .github/workflows/Windows.yml
  4. +1 −0 .gitignore
  5. +67 −1 CHANGELOG.md
  6. +2 −2 CITATION.cff
  7. +6 −0 README.md
  8. +3 −2 cmake/dependencies/CCCL.cmake
  9. +1 −1 cmake/dependencies/flamegpu2-visualiser.cmake
  10. +1 −2 cmake/dependencies/googletest.cmake
  11. +12 −0 cmake/dependencies/patches/rapidjson-cmake-3.5-deprecation.patch
  12. +35 −4 cmake/dependencies/rapidjson.cmake
  13. +7 −2 cmake/warnings.cmake
  14. +35 −16 examples/cpp/ensemble/src/main.cu
  15. +21 −0 include/flamegpu/defines.h
  16. +6 −5 include/flamegpu/detail/cuda.cuh
  17. +1 −3 include/flamegpu/detail/curand.cuh
  18. +18 −1 include/flamegpu/exception/FLAMEGPUException.h
  19. +8 −0 include/flamegpu/flamegpu.h
  20. +33 −0 include/flamegpu/io/JSONGraphReader.h
  21. +34 −0 include/flamegpu/io/JSONGraphWriter.h
  22. +5 −0 include/flamegpu/model/EnvironmentData.h
  23. +28 −0 include/flamegpu/model/EnvironmentDescription.h
  24. +73 −0 include/flamegpu/model/EnvironmentDirectedGraphData.cuh
  25. +318 −0 include/flamegpu/model/EnvironmentDirectedGraphDescription.cuh
  26. +5 −5 include/flamegpu/model/LayerDescription.h
  27. +4 −0 include/flamegpu/model/SubEnvironmentData.h
  28. +30 −5 include/flamegpu/model/SubEnvironmentDescription.h
  29. +9 −0 include/flamegpu/runtime/HostAPI.h
  30. +1 −1 include/flamegpu/runtime/detail/SharedBlock.h
  31. +1 −1 include/flamegpu/runtime/detail/curve/Curve.cuh
  32. +119 −3 include/flamegpu/runtime/detail/curve/DeviceCurve.cuh
  33. +6 −2 include/flamegpu/runtime/detail/curve/HostCurve.cuh
  34. +108 −2 include/flamegpu/runtime/detail/curve/curve_rtc.cuh
  35. +35 −1 include/flamegpu/runtime/environment/DeviceEnvironment.cuh
  36. +653 −0 include/flamegpu/runtime/environment/DeviceEnvironmentDirectedGraph.cuh
  37. +5 −5 include/flamegpu/runtime/environment/DeviceMacroProperty.cuh
  38. +23 −4 include/flamegpu/runtime/environment/HostEnvironment.cuh
  39. +440 −0 include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh
  40. +9 −2 include/flamegpu/runtime/messaging/MessageSpatial2D/MessageSpatial2DDevice.cuh
  41. +12 −3 include/flamegpu/runtime/messaging/MessageSpatial3D/MessageSpatial3DDevice.cuh
  42. +2 −2 include/flamegpu/simulation/AgentVector_Agent.h
  43. +13 −4 include/flamegpu/simulation/CUDAEnsemble.h
  44. +14 −4 include/flamegpu/simulation/CUDASimulation.h
  45. +4 −4 include/flamegpu/simulation/RunPlan.h
  46. +4 −4 include/flamegpu/simulation/RunPlanVector.h
  47. +193 −0 include/flamegpu/simulation/detail/AbstractSimRunner.h
  48. +11 −4 include/flamegpu/simulation/detail/CUDAAgent.h
  49. +407 −0 include/flamegpu/simulation/detail/CUDAEnvironmentDirectedGraphBuffers.cuh
  50. +16 −0 include/flamegpu/simulation/detail/CUDAScatter.cuh
  51. +192 −0 include/flamegpu/simulation/detail/MPIEnsemble.h
  52. +81 −0 include/flamegpu/simulation/detail/MPISimRunner.h
  53. +4 −4 include/flamegpu/simulation/detail/SimLogger.h
  54. +14 −93 include/flamegpu/simulation/detail/SimRunner.h
  55. +25 −7 include/flamegpu/util/StringPair.h
  56. +3 −3 include/flamegpu/util/cleanup.h
  57. +6 −6 include/flamegpu/util/nvtx.h
  58. +1 −1 include/flamegpu/version.h
  59. +1 −0 include/flamegpu/visualiser/color/DiscreteColor.h
  60. +62 −4 src/CMakeLists.txt
  61. +383 −0 src/flamegpu/io/JSONGraphReader.cpp
  62. +183 −0 src/flamegpu/io/JSONGraphWriter.cpp
  63. +1 −1 src/flamegpu/io/JSONStateReader.cu
  64. +12 −12 src/flamegpu/io/XMLLogger.cu
  65. +12 −12 src/flamegpu/io/XMLStateReader.cu
  66. +12 −12 src/flamegpu/io/XMLStateWriter.cu
  67. +28 −1 src/flamegpu/model/EnvironmentData.cpp
  68. +29 −0 src/flamegpu/model/EnvironmentDescription.cpp
  69. +49 −0 src/flamegpu/model/EnvironmentDirectedGraphData.cu
  70. +101 −0 src/flamegpu/model/EnvironmentDirectedGraphDescription.cu
  71. +5 −3 src/flamegpu/model/SubEnvironmentData.cpp
  72. +94 −4 src/flamegpu/model/SubEnvironmentDescription.cpp
  73. +4 −1 src/flamegpu/runtime/HostAPI.cu
  74. +15 −1 src/flamegpu/runtime/detail/curve/HostCurve.cu
  75. +430 −4 src/flamegpu/runtime/detail/curve/curve_rtc.cpp
  76. +18 −7 src/flamegpu/runtime/environment/HostEnvironment.cu
  77. +184 −0 src/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cu
  78. +273 −52 src/flamegpu/simulation/CUDAEnsemble.cu
  79. +50 −11 src/flamegpu/simulation/CUDASimulation.cu
  80. +1 −1 src/flamegpu/simulation/RunPlan.cpp
  81. +1 −1 src/flamegpu/simulation/RunPlanVector.cpp
  82. +114 −0 src/flamegpu/simulation/detail/AbstractSimRunner.cu
  83. +53 −14 src/flamegpu/simulation/detail/CUDAAgent.cu
  84. +724 −0 src/flamegpu/simulation/detail/CUDAEnvironmentDirectedGraphBuffers.cu
  85. +2 −0 src/flamegpu/simulation/detail/CUDAMessage.cu
  86. +10 −2 src/flamegpu/simulation/detail/CUDAScatter.cu
  87. +348 −0 src/flamegpu/simulation/detail/MPIEnsemble.cu
  88. +88 −0 src/flamegpu/simulation/detail/MPISimRunner.cu
  89. +3 −3 src/flamegpu/simulation/detail/SimLogger.cu
  90. +29 −91 src/flamegpu/simulation/detail/SimRunner.cu
  91. +14 −0 src/flamegpu/util/cleanup.cu
  92. +2 −2 swig/python/CMakeLists.txt
  93. +129 −17 swig/python/codegen/codegen.py
  94. +84 −3 swig/python/flamegpu.i
  95. +0 −1 swig/python/setup.py.in
  96. +29 −59 tests/CMakeLists.txt
  97. +5 −11 tests/helpers/main.cu
  98. +116 −3 tests/python/codegen/test_codegen.py
  99. +1 −1 tests/python/io/test_logging.py
  100. +1,384 −0 tests/python/runtime/environment/test_environment_directed_graph.py
  101. +2 −2 tests/python/simulation/test_cuda_ensemble.py
  102. +64 −0 tests/python/test_mpi.py
  103. +1 −0 tests/python/util/test_cleanup.py
  104. +1 −1 tests/test_cases/io/test_logging.cu
  105. +1,857 −0 tests/test_cases/runtime/environment/test_environment_directed_graph.cu
  106. +119 −0 tests/test_cases/runtime/messaging/test_spatial_2d.cu
  107. +139 −0 tests/test_cases/runtime/messaging/test_spatial_3d.cu
  108. +3 −3 tests/test_cases/simulation/test_cuda_ensemble.cu
  109. +476 −0 tests/test_cases/simulation/test_mpi_ensemble.cu
  110. +1 −1 tests/test_cases/util/test_cleanup.cu
261 changes: 261 additions & 0 deletions .github/workflows/MPI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
# Perform builds with supported MPI versions
name: MPI

on:
# On pull_requests which mutate this CI workflow, using pr rather than push:branch to ensure that the merged state will be OK, as that is what is important here.
pull_request:
paths:
- ".github/workflows/MPI.yml"
- "tests/test_cases/simulation/test_mpi_ensemble.cu"
- "include/flamegpu/simulation/detail/MPISimRunner.h"
- "include/flamegpu/simulation/detail/AbstractSimRunner.h"
- "src/flamegpu/simulation/detail/MPISimRunner.cu"
- "src/flamegpu/simulation/detail/AbstractSimRunner.cu"
- "src/flamegpu/simulation/CUDAEnsemble.cu"
- "**mpi**"
- "**MPI**"
# Or trigger on manual dispatch.
workflow_dispatch:

defaults:
run:
# Default to using bash regardless of OS unless otherwise specified.
shell: bash

jobs:
build-ubuntu:
runs-on: ${{ matrix.cudacxx.os }}
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.0"
cuda_arch: "50-real;"
hostcxx: gcc-11
os: ubuntu-22.04
python:
- "3.8"
mpi:
- lib: "openmpi"
version: "apt" # MPI 3.1
# - lib: "openmpi"
# version: "4.1.6" # MPI 3.1
# - lib: "openmpi"
# version: "4.0.0" # MPI 3.1
# - lib: "openmpi"
# version: "3.0.0" # MPI 3.1
# - lib: "openmpi"
# version: "2.0.0" # MPI 3.1
- lib: "openmpi"
version: "1.10.7" # MPI 3.0
- lib: "mpich"
version: "apt" # MPI 4.0
# - lib: "mpich"
# version: "4.1.2" # MPI 4.0
# - lib: "mpich"
# version: "4.0" # MPI 4.0
# - lib: "mpich"
# version: "3.4.3" # MPI 3.1
- lib: "mpich"
version: "3.3" # MPI 3.1
config:
- name: "Release"
config: "Release"
SEATBELTS: "ON"
VISUALISATION:
- "OFF"

# Name the job based on matrix/env options
name: "build-ubuntu-mpi (${{ matrix.mpi.lib }}, ${{ matrix.mpi.version }}, ${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"

# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
# Define constants
BUILD_DIR: "build"
FLAMEGPU_BUILD_TESTS: "ON"
# Conditional based on matrix via awkward almost ternary
FLAMEGPU_BUILD_PYTHON: ${{ fromJSON('{true:"ON",false:"OFF"}')[matrix.python != ''] }}
# Port matrix options to environment, for more portability.
CUDA: ${{ matrix.cudacxx.cuda }}
CUDA_ARCH: ${{ matrix.cudacxx.cuda_arch }}
HOSTCXX: ${{ matrix.cudacxx.hostcxx }}
OS: ${{ matrix.cudacxx.os }}
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python }}
MPI_LIB: ${{ matrix.mpi.lib }}
MPI_VERSION: ${{ matrix.mpi.version }}
VISUALISATION: ${{ matrix.VISUALISATION }}

steps:
- uses: actions/checkout@v3

- name: Install CUDA
if: ${{ startswith(env.OS, 'ubuntu') && env.CUDA != '' }}
env:
cuda: ${{ env.CUDA }}
run: .github/scripts/install_cuda_ubuntu.sh

- name: Install/Select gcc and g++
if: ${{ startsWith(env.HOSTCXX, 'gcc-') }}
run: |
gcc_version=${HOSTCXX//gcc-/}
sudo apt-get install -y gcc-${gcc_version} g++-${gcc_version}
echo "CC=/usr/bin/gcc-${gcc_version}" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
echo "CUDAHOSTCXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
- name: Install MPI from apt
if: ${{ env.MPI_VERSION == 'apt' }}
working-directory: ${{ runner.temp }}
run: |
sudo apt-get install lib${{ env.MPI_LIB }}-dev
- name: Install OpenMPI from source
if: ${{ env.MPI_VERSION != 'apt' && env.MPI_LIB == 'openmpi' }}
working-directory: ${{ runner.temp }}
run: |
# Note: using download.open-mpi.org as gh tags aren't pre configured
MPI_VERISON_MAJOR_MINOR=$(cut -d '.' -f 1,2 <<< "${{ env.MPI_VERSION}}")
echo "https://download.open-mpi.org/release/open-mpi/v${MPI_VERISON_MAJOR_MINOR}/openmpi-${{ env.MPI_VERSION}}.tar.gz"
wget -q https://download.open-mpi.org/release/open-mpi/v${MPI_VERISON_MAJOR_MINOR}/openmpi-${{ env.MPI_VERSION}}.tar.gz --output-document openmpi-${{ env.MPI_VERSION }}.tar.gz || (echo "An Error occurred while downloading OpenMPI '${{ env.MPI_VERSION }}'. Is it a valid version of OpenMPI?" && exit 1)
tar -zxvf openmpi-${{ env.MPI_VERSION }}.tar.gz
cd openmpi-${{ env.MPI_VERSION}}
./configure --prefix="${{ runner.temp }}/mpi"
make -j `nproc`
make install -j `nproc`
echo "${{ runner.temp }}/mpi/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${{ runner.temp }}/mpi/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "LD_RUN_PATH=${{ runner.temp }}/mpi/lib:${LD_RUN_PATH}" >> $GITHUB_ENV
# This will only work for mpich >= 3.3:
# 3.0-3.2 doesn't appear compatible with default gcc in 22.04.
# 1.x is named mpich2 so requires handling differently
# Uses the ch3 interface, as ch4 isn't available pre 3.4, but one must be specified for some versions
- name: Install MPICH from source
if: ${{ env.MPI_VERSION != 'apt' && env.MPI_LIB == 'mpich' }}
working-directory: ${{ runner.temp }}
run: |
MPI_MAJOR=$(cut -d '.' -f 1 <<< "${{ env.MPI_VERSION}}")
MPI_MINOR=$(cut -d '.' -f 2 <<< "${{ env.MPI_VERSION}}")
[[ ${MPI_MAJOR} < 3 ]] && echo "MPICH must be >= 3.0" && exit 1
echo "https://www.mpich.org/static/downloads/${{ env.MPI_VERSION }}/mpich-${{ env.MPI_VERSION}}.tar.gz"
wget -q https://www.mpich.org/static/downloads/${{ env.MPI_VERSION }}/mpich-${{ env.MPI_VERSION}}.tar.gz --output-document mpich-${{ env.MPI_VERSION }}.tar.gz || (echo "An Error occurred while downloading MPICH '${{ env.MPI_VERSION }}'. Is it a valid version of MPICH?" && exit 1)
tar -zxvf mpich-${{ env.MPI_VERSION }}.tar.gz
cd mpich-${{ env.MPI_VERSION}}
DISABLE_FORTRAN_FLAGS=""
if (( ${MPI_MAJOR} >= 4 )) || ( ((${MPI_MAJOR} >= 3)) && ((${MPI_MINOR} >= 2)) ); then
# MPICH >= 3.2 has --disable-fortran
DISABLE_FORTRAN_FLAGS="--disable-fortran"
else
DISABLE_FORTRAN_FLAGS="--disable-f77 --disable-fc"
fi
./configure --prefix="${{ runner.temp }}/mpi" --with-device=ch3 ${DISABLE_FORTRAN_FLAGS}
make -j `nproc`
make install -j `nproc`
echo "${{ runner.temp }}/mpi/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${{ runner.temp }}/mpi/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "LD_RUN_PATH=${{ runner.temp }}/mpi/lib:${LD_RUN_PATH}" >> $GITHUB_ENV
- name: Select Python
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON }}

- name: Install python dependencies
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
run: |
sudo apt-get install python3-venv
python3 -m pip install --upgrade wheel build setuptools
- name: Install Visualisation Dependencies
if: ${{ startswith(env.OS, 'ubuntu') && env.VISUALISATION == 'ON' }}
run: |
# Install ubuntu-20.04 packages
if [ "$OS" == 'ubuntu-20.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
fi
# Install Ubuntu 18.04 packages
if [ "$OS" == 'ubuntu-18.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype6-dev libgl1-mesa-dev
fi
- name: Install Swig >= 4.0.2
run: |
# Remove existing swig install, so CMake finds the correct swig
if [ "$OS" == 'ubuntu-20.04' ]; then
sudo apt-get remove -y swig swig4.0
fi
# Install Ubuntu 18.04 packages
if [ "$OS" == 'ubuntu-18.04' ]; then
sudo apt-get remove -y swig
fi
# Install additional apt-based dependencies required to build swig 4.0.2
sudo apt-get install -y bison
# Create a local directory to build swig in.
mkdir -p swig-from-source && cd swig-from-source
# Install SWIG building from source dependencies
wget https://github.com/swig/swig/archive/refs/tags/v4.0.2.tar.gz
tar -zxf v4.0.2.tar.gz
cd swig-4.0.2/
./autogen.sh
./configure
make
sudo make install
# This pre-emptively patches a bug where ManyLinux didn't generate buildnumber as git dir was owned by diff user
- name: Enable git safe-directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-DCMAKE_BUILD_TYPE="${{ env.CONFIG }}"
-Werror=dev
-DCMAKE_WARN_DEPRECATED="OFF"
-DFLAMEGPU_WARNINGS_AS_ERRORS="ON"
-DCMAKE_CUDA_ARCHITECTURES="${{ env.CUDA_ARCH }}"
-DFLAMEGPU_BUILD_TESTS="${{ env.FLAMEGPU_BUILD_TESTS }}"
-DFLAMEGPU_BUILD_PYTHON="${{ env.FLAMEGPU_BUILD_PYTHON }}"
-DPYTHON3_EXACT_VERSION="${{ env.PYTHON }}"
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_MPI="ON"
-DFLAMEGPU_ENABLE_NVTX="ON"
${MPI_OVERRIDE_CXX_OPTIONS}
- name: Reconfigure cmake fixing MPICH from apt
if: ${{ env.MPI_VERSION == 'apt' && env.MPI_LIB == 'mpich' }}
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-DMPI_CXX_COMPILE_OPTIONS=""
- name: Build static library
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target flamegpu --verbose -j `nproc`

- name: Build python wheel
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target pyflamegpu --verbose -j `nproc`

- name: Build tests
if: ${{ env.FLAMEGPU_BUILD_TESTS == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target tests --verbose -j `nproc`

- name: Build tests_mpi
if: ${{ env.FLAMEGPU_BUILD_TESTS == 'ON' }}
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target tests_mpi --verbose -j `nproc`

- name: Build ensemble example
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target ensemble --verbose -j `nproc`

- name: Build all remaining targets
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target all --verbose -j `nproc`
5 changes: 5 additions & 0 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -186,6 +186,11 @@ jobs:
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
# Check for bugs when cmake is reconfigured, i.e. fetch content patching
- name: Re-configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
- name: Build static library
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --target flamegpu --verbose -j `nproc`
5 changes: 5 additions & 0 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
@@ -146,6 +146,11 @@ jobs:
-DFLAMEGPU_VISUALISATION="${{ env.VISUALISATION }}"
-DFLAMEGPU_ENABLE_NVTX="ON"
# Check for bugs when cmake is reconfigured, i.e. fetch content patching
- name: Re-configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
- name: Build static library
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --config ${{ env.CONFIG }} --target flamegpu --verbose -j `nproc`
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
*.json
*.gv
*.bin
*test_rtcfunc_file

# GoogleTest directories (handled by CMake)
googletest-build/
Loading