Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for MSVC 1940 & 1941, CMake 3.30, Github Actions Node16 #1225

Merged
merged 14 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/scripts/install_cuda_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ $CUDA_KNOWN_URLS = @{
"12.2.1" = "https://developer.download.nvidia.com/compute/cuda/12.2.1/network_installers/cuda_12.2.1_windows_network.exe";
"12.2.2" = "https://developer.download.nvidia.com/compute/cuda/12.2.2/network_installers/cuda_12.2.2_windows_network.exe";
"12.3.0" = "https://developer.download.nvidia.com/compute/cuda/12.3.0/network_installers/cuda_12.3.0_windows_network.exe";
"12.3.1" = "https://developer.download.nvidia.com/compute/cuda/12.3.1/network_installers/cuda_12.3.1_windows_network.exe";
"12.3.2" = "https://developer.download.nvidia.com/compute/cuda/12.3.2/network_installers/cuda_12.3.2_windows_network.exe";
"12.4.0" = "https://developer.download.nvidia.com/compute/cuda/12.4.0/network_installers/cuda_12.4.0_windows_network.exe";
"12.4.1" = "https://developer.download.nvidia.com/compute/cuda/12.4.1/network_installers/cuda_12.4.1_windows_network.exe";
"12.5.0" = "https://developer.download.nvidia.com/compute/cuda/12.5.0/network_installers/cuda_12.5.0_windows_network.exe";
"12.5.1" = "https://developer.download.nvidia.com/compute/cuda/12.5.1/network_installers/cuda_12.5.1_windows_network.exe";
"12.6.0" = "https://developer.download.nvidia.com/compute/cuda/12.6.0/network_installers/cuda_12.6.0_windows_network.exe";
}

# @todo - change this to be based on _MSC_VER intead, or invert it to be CUDA keyed instead
Expand Down
29 changes: 23 additions & 6 deletions .github/workflows/Draft-Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.6"
cuda_arch: "50-real;90-real;90-virtual;"
hostcxx: gcc-12
os: ubuntu-22.04
- cuda: "12.0"
cuda_arch: "50-real;90-real;90-virtual;"
hostcxx: gcc-11
Expand Down Expand Up @@ -115,23 +119,26 @@ jobs:
- name: Install Visualisation Dependencies
if: ${{ startswith(env.OS, 'ubuntu') && env.VISUALISATION == 'ON' }}
run: |
# Install ubuntu-22.04 packages
if [ "$OS" == 'ubuntu-22.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
fi
# Install ubuntu-20.04 packages
if [ "$OS" == 'ubuntu-20.04' ]; then
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
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
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
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
Expand Down Expand Up @@ -194,10 +201,14 @@ jobs:
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.0.0"
- cuda: "12.6.0"
cuda_arch: "50-real;90-real;90-virtual"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
- cuda: "12.0.0"
cuda_arch: "50-real;90-real;90-virtual"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.8.0"
cuda_arch: "35-real;90-real;90-virtual"
hostcxx: "Visual Studio 16 2019"
Expand Down Expand Up @@ -234,6 +245,8 @@ jobs:
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Ensure MSVC >= 1940 works with CUDA <= 12.3
CUDAFLAGS: -allow-unsupported-compiler

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -358,6 +371,8 @@ jobs:
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Short term fix to use node16 not node20 for actions. This will stop working eventually, forcing our hand in dropping manylinux2014 support.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -515,6 +530,8 @@ jobs:
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Ensure MSVC >= 1940 works with CUDA <= 12.3
CUDAFLAGS: -allow-unsupported-compiler

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/Manylinux2014.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Short term fix to use node16 not node20 for actions. This will stop working eventually, forcing our hand in dropping manylinux2014 support.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ jobs:
# optional exclude: can be partial, include: must be specific
matrix:
cudacxx:
- cuda: "12.3"
- cuda: "12.6"
cuda_arch: "50"
hostcxx: gcc-12
os: ubuntu-22.04
- cuda: "12.0"
cuda_arch: "50"
hostcxx: gcc-12
os: ubuntu-22.04
Expand All @@ -54,11 +58,18 @@ jobs:
- "ON"
- "OFF"
exclude:
# Exclude VIS=ON for oldest cuda.
# Exclude VIS=ON for oldest cuda of each major version
- cudacxx:
cuda: "12.0"
VISUALISATION: "ON"
- cudacxx:
cuda: "11.0"
VISUALISATION: "ON"
# Exclude beltsoff builds for old cuda's
# Exclude beltsoff builds for all but the most recent cuda
- cudacxx:
cuda: "12.0"
config:
name: "Beltsoff"
- cudacxx:
cuda: "11.8"
config:
Expand Down Expand Up @@ -129,10 +140,11 @@ jobs:
- name: Install Visualisation Dependencies
if: ${{ startswith(env.OS, 'ubuntu') && env.VISUALISATION == 'ON' }}
run: |
# Install ubuntu-20.04 packages
# Install ubuntu-22.04 packages
if [ "$OS" == 'ubuntu-22.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
fi
# 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
Expand All @@ -147,7 +159,6 @@ jobs:
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
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/Windows-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ jobs:
matrix:
# CUDA_ARCH values are reduced compared to wheels due to CI memory issues while compiling the test suite.
cudacxx:
- cuda: "12.0.0"
- cuda: "12.6.0"
cuda_arch: "50"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
- cuda: "12.0.0"
cuda_arch: "50"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.8.0"
cuda_arch: "35"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.0.3"
cuda_arch: "35"
hostcxx: "Visual Studio 16 2019"
Expand Down Expand Up @@ -59,6 +62,8 @@ jobs:
CONFIG: ${{ matrix.config.config }}
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Ensure MSVC >= 1940 works with CUDA <= 12.3
CUDAFLAGS: -allow-unsupported-compiler

steps:
- uses: actions/checkout@v3
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ jobs:
# optional exclude: can be partial, include: must be specific
matrix:
cudacxx:
- cuda: "12.3.0"
- cuda: "12.6.0"
cuda_arch: "50"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
- cuda: "12.0.0"
cuda_arch: "50"
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.8.0"
cuda_arch: "35"
hostcxx: "Visual Studio 17 2022"
os: windows-2022
hostcxx: "Visual Studio 16 2019"
os: windows-2019
- cuda: "11.0.3"
cuda_arch: "35"
hostcxx: "Visual Studio 16 2019"
Expand All @@ -54,11 +58,18 @@ jobs:
- "ON"
- "OFF"
exclude:
# Exclude VIS=ON for oldest cuda.
# Exclude VIS=ON for oldest cuda of each major version
- cudacxx:
cuda: "12.0.0"
VISUALISATION: "ON"
- cudacxx:
cuda: "11.0.3"
VISUALISATION: "ON"
# Exclude beltsoff builds for old cuda's
# Exclude beltsoff builds for all but the most recent cuda
- cudacxx:
cuda: "12.0.0"
config:
name: "Beltsoff"
- cudacxx:
cuda: "11.8.0"
config:
Expand Down Expand Up @@ -98,6 +109,8 @@ jobs:
FLAMEGPU_SEATBELTS: ${{ matrix.config.SEATBELTS }}
PYTHON: ${{ matrix.python}}
VISUALISATION: ${{ matrix.VISUALISATION }}
# Ensure MSVC >= 1940 works with CUDA <= 12.3
CUDAFLAGS: -allow-unsupported-compiler


steps:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set(MINIMUM_SUPPORTED_CUDA_VERSION 11.0)
set(MINIMUM_CUDA_VERSION 11.0)

# If the CUDA compiler is too old, trigger a docs only build.
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS ${MINIMUM_CUDA_VERSION})
if(NOT DOCUMENTATION_ONLY_BUILD AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS ${MINIMUM_CUDA_VERSION})
set(DOCUMENTATION_ONLY_BUILD ON)
message(STATUS "Documentation-only build: CUDA ${MINIMUM_SUPPORTED_CUDA_VERSION} or greater is required for compilation.")
endif()
Expand Down
41 changes: 40 additions & 1 deletion cmake/CheckCompilerFunctionality.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,46 @@ function(flamegpu_check_compiler_functionality)
enable_language(CXX)
check_language(CUDA)
if(NOT CMAKE_CUDA_COMPILER)
message(WARNING "CUDA Language Support Not Found")
# MSVC 1941 (VS2022 17.11) requires CUDA 12.4 or greater - see https://github.com/microsoft/STL/pull/4475
if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL "1941")
message(WARNING
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1941)\n"
" \n"
" The MSVC STL included with MSVC 1941 requires CUDA 12.4 or newer\n"
" If you have CUDA <= 12.3 installed you must either:\n"
" - Upgrade CUDA to >= 12.4\n"
" - Downgrade MSVC to 1940 and set the CUDAFLAGS environment variable to contain '-allow-unsupported-compiler'\n"
" - Downgrade MSVC to 1939 or older\n"
" You must then clear the CMake cache before reconfiguring\n"
)
# If using MSVC >= 1940 then CUDA <= 12.3 support requires -allow-unsupported-compiler, so warn about this
elseif(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL "1940")
# If this is the case, then CMake >= 3.29.4 is also required, otherwise CMake does not pass -allow-unsupported-compiler along, warn as appropriate
if(CMAKE_VERSION VERSION_LESS "3.29.4")
message(WARNING
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1940)\n"
" \n"
" If you have CUDA <= 12.3 installed:\n"
" - You must upgrade CMake to be >= 3.29.4\n"
" The CUDAFLAGS environment variable must include '-allow-unsupported-compiler'\n"
" You must clear the CMake Cache before reconfiguring this project\n"
" \n"
" - Alternatively you may upgrade CUDA to >= 12.4 and clear the CMake Cache before reconfiguring\n"
)
else()
message(WARNING
" CUDA Language Support Not Found (with MSVC ${MSVC_VERSION} >= 1940)\n"
" \n"
" If you have CUDA <= 12.3 installed:\n"
" - The CUDAFLAGS environment variable must include '-allow-unsupported-compiler'\n"
" You must clear the CMake Cache before reconfiguring this project\n"
" \n"
" - Alternatively you may upgrade CUDA to >= 12.4 and clear the CMake Cache before reconfiguring\n"
)
endif()
else()
message(WARNING "CUDA Language Support Not Found")
endif()
set(FLAMEGPU_CheckCompilerFunctionality_RESULT "NO" PARENT_SCOPE)
return()
endif()
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/Jitify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)
cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

# Change the source-dir to allow inclusion via jitify/jitify.hpp rather than jitify.hpp
FetchContent_Declare(
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/Thrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})

include(FetchContent)
cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

# Set the minimum supported cub/thrust version, and the version to fetch
# Thrust minimum version to 1.16 to avoid windows.h related issues and pull in bug fixes, but fetch the most recent 1.x release otherwise (at the time of writing).
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/Tinyxml2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)

cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

# Change the source_dir to allow inclusion via tinyxml2/tinyxml2.h rather than tinyxml2.h
FetchContent_Declare(
Expand Down
6 changes: 5 additions & 1 deletion cmake/dependencies/flamegpu2-visualiser.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)
cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

# Set the visualiser repo and tag to use unless overridden by the user.
set(DEFAULT_FLAMEGPU_VISUALISATION_GIT_VERSION "flamegpu-2.0.0-rc.1")
set(DEFAULT_FLAMEGPU_VISUALISATION_GIT_VERSION "3befb5964fc5e24c375e872ebbb5d903e878b5e0")
set(DEFAULT_FLAMEGPU_VISUALISATION_REPOSITORY "https://github.com/FLAMEGPU/FLAMEGPU2-visualiser.git")

# Set a VISUSLAITION_ROOT cache entry so it is available in the GUI to override the location if required
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/glm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)
cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

FetchContent_Declare(
googletest
Expand Down
4 changes: 4 additions & 0 deletions cmake/dependencies/rapidjson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules/ ${CMAKE_MODULE_PATH})
include(FetchContent)
include(ExternalProject)
cmake_policy(SET CMP0079 NEW)
# Temporary CMake >= 3.30 fix https://github.com/FLAMEGPU/FLAMEGPU2/issues/1223
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
endif()

# a95e013b97ca6523f32da23f5095fcc9dd6067e5 is the last commit before a change which breaks our method of finding rapid json without running a cmake install first.
# but we also need to patch this to avoid a cmake >= 3.26.4 deprecation, but this is handled manually post-population
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/circles_bruteforce/src/main.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <float.h>
#include "flamegpu/flamegpu.h"

FLAMEGPU_AGENT_FUNCTION(output_message, flamegpu::MessageNone, flamegpu::MessageBruteForce) {
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/circles_spatial3D/src/main.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <float.h>
#include "flamegpu/flamegpu.h"

FLAMEGPU_AGENT_FUNCTION(output_message, flamegpu::MessageNone, flamegpu::MessageSpatial3D) {
Expand Down
Loading
Loading