diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index da9c113828cb..c6aa6a5efae8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,6 +72,7 @@ env:
alpaka_ACC_GPU_HIP_ENABLE: OFF
alpaka_ACC_GPU_HIP_ONLY_MODE: OFF
alpaka_USE_MDSPAN: OFF
+ alpaka_ENABLE_WERROR: ON
CMAKE_INSTALL_PREFIX: ${{ github.workspace }}/_install
jobs:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 685555e37b0a..860796f5c279 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,7 @@ option(alpaka_BUILD_EXAMPLES "Build the examples" OFF)
# Enable the test infrastructure only if alpaka is the top-level project
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
+ option(alpaka_ENABLE_WERROR "Treat all warnings as errors." OFF)
option(BUILD_TESTING "Build the testing tree." OFF)
include(CTest)
endif()
diff --git a/README.md b/README.md
index 3a9c1dfc034f..9b4821f56853 100644
--- a/README.md
+++ b/README.md
@@ -65,20 +65,21 @@ Supported Compilers
This library uses C++17 (or newer when available).
-| Accelerator Back-end | gcc 9.5
(Linux) | gcc 10.4 / 11.1
(Linux) | gcc 12.3
(Linux) | gcc 13.1
(Linux) | clang 9
(Linux) | clang 10 / 11
(Linux) | clang 12
(Linux) | clang 13
(Linux) | clang 14
(Linux) | clang 15
(Linux) | clang 16
(Linux) | icpx (latest) | Xcode 13.2.1 / 14.2 / 14.3.1
(macOS) | Visual Studio 2022
(Windows) |
-|--------------------------------------------------------------------------------|---------------------------------------------|---------------------------------------------|---------------------------------------------|------------------------|--------------------------------------------------------|---------------------------------------------------------|--------------------------------------------------|---------------------------------------------|---------------------------------------------------|-------------------------------------------|-------------------------------------------|--------------------|-------------------------------------------------------|--------------------------------------|
-| Serial | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| OpenMP 2.0+ blocks | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| OpenMP 2.0+ threads | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| std::thread | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| TBB | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| CUDA (nvcc) | :white_check_mark:
(CUDA 11.0 - 12.2) | :white_check_mark:
(CUDA 11.4 - 12.0) | :white_check_mark:
(CUDA 12.0 - 12.2) | :x: | :white_check_mark:
(CUDA 11.0-11.2; 11.6 - 12.0) | :white_check_mark:
(CUDA 11.2, 11.6 - 12.0) | :white_check_mark:
(CUDA 11.6 - 12.0) | :white_check_mark:
(CUDA 11.7 - 12.0) | :white_check_mark:
(CUDA 11.8 - 12.0) | :white_check_mark:
(CUDA 12.2) | :x: | :x: | :x: | :x: |
-| CUDA (clang) | - | - | - | :x: | :x: | :x: | :x: | :x: | :white_check_mark: (CUDA 11.0 - 11.5) | :white_check_mark: (CUDA 11.0 - 11.5)[^1] | :white_check_mark: (CUDA 11.0 - 11.5)[^1] | :x: | - | - |
-| [HIP](https://alpaka.readthedocs.io/en/latest/install/HIP.html) (clang) | - | - | - | :x: | :x: | :x: | :x: | :x: | :white_check_mark: (HIP 5.0 - 5.2) | :white_check_mark: (HIP 5.3 - 5.4) | :white_check_mark: (HIP 5.5) | :x: | - | - |
+| Accelerator Back-end | gcc 9.5
(Linux) | gcc 10.4 / 11.1
(Linux) | gcc 12.3
(Linux) | gcc 13.1
(Linux) | clang 9
(Linux) | clang 10 / 11
(Linux) | clang 12
(Linux) | clang 13
(Linux) | clang 14
(Linux) | clang 15
(Linux) | clang 16
(Linux) | icpx (latest) | Xcode 13.2.1 / 14.2 / 14.3.1
(macOS) | Visual Studio 2022
(Windows) |
+|--------------------------------------------------------------------------------|-------------------------------------------------|-------------------------------------------------|---------------------------------------------|------------------------|------------------------------------------------------------|-------------------------------------------------------|-------------------------------------------------|---------------------------------------------|---------------------------------------------------|-------------------------------------------|-------------------------------------------|--------------------|-------------------------------------------------------|--------------------------------------|
+| Serial | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| OpenMP 2.0+ blocks | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| OpenMP 2.0+ threads | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| std::thread | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| TBB | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| CUDA (nvcc) | :white_check_mark:
(CUDA 11.0 - 12.2)[^2] | :white_check_mark:
(CUDA 11.4 - 12.0)[^2] | :white_check_mark:
(CUDA 12.0 - 12.2) | :x: | :white_check_mark:
(CUDA 11.0-11.2; 11.6 - 12.0)[^2] | :white_check_mark:
(CUDA 11.2, 11.6 - 12.0)[^2] | :white_check_mark:
(CUDA 11.6 - 12.0)[^2] | :white_check_mark:
(CUDA 11.7 - 12.0) | :white_check_mark:
(CUDA 11.8 - 12.0) | :white_check_mark:
(CUDA 12.2) | :x: | :x: | :x: | :x: |
+| CUDA (clang) | - | - | - | :x: | :x: | :x: | :x: | :x: | :white_check_mark: (CUDA 11.0 - 11.5) | :white_check_mark: (CUDA 11.0 - 11.5)[^1] | :white_check_mark: (CUDA 11.0 - 11.5)[^1] | :x: | - | - |
+| [HIP](https://alpaka.readthedocs.io/en/latest/install/HIP.html) (clang) | - | - | - | :x: | :x: | :x: | :x: | :x: | :white_check_mark: (HIP 5.0 - 5.2) | :white_check_mark: (HIP 5.3 - 5.4) | :white_check_mark: (HIP 5.5) | :x: | - | - |
Other compilers or combinations marked with :x: in the table above may work but are not tested in CI and are therefore not explicitly supported.
-[^1]: Due to a [compiler bug](https://github.com/llvm/llvm-project/issues/58491) in debug mode only release builds are supported.
+[^1]: Due to an [LLVM bug](https://github.com/llvm/llvm-project/issues/58491) in debug mode only release builds are supported.
+[^2]: Due to a [CUDA bug](https://github.com/alpaka-group/alpaka/issues/2035) debug builds are only supported for CUDA versions >= 11.7.
Dependencies
------------
diff --git a/cmake/alpakaCommon.cmake b/cmake/alpakaCommon.cmake
index c6baf3c800b0..c7d8b28b382c 100644
--- a/cmake/alpakaCommon.cmake
+++ b/cmake/alpakaCommon.cmake
@@ -184,6 +184,16 @@ else()
target_link_libraries(alpaka INTERFACE ${RT_LIBRARY})
endif()
endif()
+
+ # Add debug optimization levels. CMake doesn't do this by default.
+ # Note that -Og is the recommended gcc optimization level for debug mode but is equivalent to -O1 for clang (and its derivates).
+ alpaka_set_compiler_options(HOST_DEVICE target alpaka $<$,$,$>:-Og>
+ $<$,$,$>:-Xcompiler -Og>
+ $<$,$>:-O0>
+ $<$,$>:/Od>)
+
+ target_link_options(alpaka INTERFACE $<$,$>:-Og>
+ $<$,$>:-O0>)
endif()
#-------------------------------------------------------------------------------
@@ -345,7 +355,7 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
if(CMAKE_CUDA_COMPILER)
if(NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
# Use user selected CMake CXX compiler or CMAKE_CUDA_HOST_COMPILER as cuda host compiler to avoid fallback to the default system CXX host compiler.
- # CMAKE_CUDA_HOST_COMPILER is reset by check_language(CUDA) therefore definition passed by the user via -DCMAKE_CUDA_HOST_COMPILER are
+ # CMAKE_CUDA_HOST_COMPILER is reset by check_language(CUDA) therefore definitions passed by the user via -DCMAKE_CUDA_HOST_COMPILER are
# ignored by CMake (looks like a CMake bug).
if(_alpaka_CUDA_HOST_COMPILER)
set(CMAKE_CUDA_HOST_COMPILER ${_alpaka_CUDA_HOST_COMPILER})
@@ -418,13 +428,12 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
if(alpaka_CUDA_EXPT_EXTENDED_LAMBDA STREQUAL ON)
alpaka_set_compiler_options(DEVICE target alpaka $<$:--extended-lambda>)
endif()
- # This is mandatory because with c++17 many standard library functions we rely on are constexpr (std::min, std::multiplies, ...)
+ # This is mandatory because with C++17 many standard library functions we rely on are constexpr (std::min, std::multiplies, ...)
alpaka_set_compiler_options(DEVICE target alpaka $<$:--expt-relaxed-constexpr>)
- if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- alpaka_set_compiler_options(DEVICE target alpaka $<$:-g>)
- alpaka_set_compiler_options(DEVICE target alpaka $<$:-lineinfo>)
- endif()
+ # CMake automatically sets '-g' in debug mode
+ alpaka_set_compiler_options(DEVICE target alpaka $<$,$>:-G> # -G overrides -lineinfo
+ $<$,$>:-g -lineinfo>)
if(alpaka_FAST_MATH STREQUAL ON)
alpaka_set_compiler_options(DEVICE target alpaka $<$:--use_fast_math>)
diff --git a/script/docker_ci.sh b/script/docker_ci.sh
index 69feaad0098a..5d543a569474 100755
--- a/script/docker_ci.sh
+++ b/script/docker_ci.sh
@@ -179,5 +179,9 @@ if [ ! -z "${alpaka_USE_MDSPAN+x}" ]
then
ALPAKA_DOCKER_ENV_LIST+=("--env" "alpaka_USE_MDSPAN=${alpaka_USE_MDSPAN}")
fi
+if [ ! -z "${alpaka_ENABLE_WERROR+x}" ]
+then
+ ALPAKA_DOCKER_ENV_LIST+=("--env" "alpaka_ENABLE_WERROR=${alpaka_ENABLE_WERROR}")
+fi
docker_retry docker run -v "$(pwd)":"$(pwd)" -w "$(pwd)" "${ALPAKA_DOCKER_ENV_LIST[@]}" "${ALPAKA_CI_DOCKER_BASE_IMAGE_NAME}" /bin/bash -c "source ./script/install.sh && ./script/run.sh"
diff --git a/script/job_generator/alpaka_filter.py b/script/job_generator/alpaka_filter.py
index 992f60928102..3fa921c51fe9 100644
--- a/script/job_generator/alpaka_filter.py
+++ b/script/job_generator/alpaka_filter.py
@@ -22,5 +22,14 @@ def alpaka_post_filter(row: List) -> bool:
for clang_cuda_version in ["15", "16"]:
if row_check_version(row, HOST_COMPILER, "==", clang_cuda_version):
return False
+
+ # Debug builds with nvcc <= 11.6 produce compiler errors
+ if (
+ is_in_row(row, BUILD_TYPE)
+ and row[param_map[BUILD_TYPE]][VERSION] == CMAKE_DEBUG
+ and row_check_name(row, DEVICE_COMPILER, "==", NVCC)
+ and row_check_version(row, DEVICE_COMPILER, "<=", "11.6")
+ ):
+ return False
return True
diff --git a/script/job_generator/generate_job_yaml.py b/script/job_generator/generate_job_yaml.py
index 19824d773561..77975a9917f9 100644
--- a/script/job_generator/generate_job_yaml.py
+++ b/script/job_generator/generate_job_yaml.py
@@ -249,6 +249,8 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
variables["ALPAKA_CI_CUDA_DIR"] = "$HOME/cuda"
# hip install path, if hip version is not already installed
variables["ALPAKA_CI_HIP_ROOT_DIR"] = "$HOME/hip"
+ # Always enable -Werror in the CI
+ variables["alpaka_ENABLE_WERROR"] = "ON"
################################################################################################
### job dependent environment variables
@@ -391,7 +393,6 @@ def global_variables() -> Dict[str, str]:
variables["ALPAKA_CI_OS_NAME"] = "Linux"
variables[ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE] = "ON"
- variables[ALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE] = "ON"
@@ -413,6 +414,7 @@ def global_variables() -> Dict[str, str]:
variables["ALPAKA_CI_BOOST_LIB_DIR"] = "$HOME/boost_libs"
variables["ALPAKA_CI_CUDA_DIR"] = "$HOME/cuda"
variables["ALPAKA_CI_HIP_ROOT_DIR"] = "$HOME/hip"
+ variables["alpaka_ENABLE_WERROR"] ="ON"
return variables
diff --git a/test/common/CMakeLists.txt b/test/common/CMakeLists.txt
index 01ac526ea95d..ce253fc69d17 100644
--- a/test/common/CMakeLists.txt
+++ b/test/common/CMakeLists.txt
@@ -19,15 +19,13 @@ if(MSVC)
target_compile_options(${_COMMON_TARGET_NAME} INTERFACE $<$:/bigobj> $<$:-Xcompiler=/bigobj>)
endif()
-if(alpaka_ACC_GPU_CUDA_ENABLE OR (alpaka_ACC_GPU_HIP_ENABLE AND HIP_PLATFORM MATCHES "nvcc"))
+if(alpaka_ACC_GPU_CUDA_ENABLE)
# CUDA driver API is used by EventHostManualTrigger
target_link_libraries(${_COMMON_TARGET_NAME} INTERFACE CUDA::cuda_driver)
target_compile_definitions(${_COMMON_TARGET_NAME} INTERFACE "CUDA_API_PER_THREAD_DEFAULT_STREAM")
endif()
-if(alpaka_ACC_GPU_CUDA_ENABLE AND CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
- # nvcc supports werror starting with 10.2
- if(CUDA_VERSION GREATER_EQUAL 10.2)
- message(STATUS "adding -Werror=all-warnings")
+if(alpaka_ACC_GPU_CUDA_ENABLE AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ if(alpaka_ENABLE_WERROR)
target_compile_options(${_COMMON_TARGET_NAME} INTERFACE $<$:-Werror=all-warnings>)
endif()
endif()
diff --git a/test/common/devCompileOptions.cmake b/test/common/devCompileOptions.cmake
index 1c2fdb82a93c..b6b654c893f7 100644
--- a/test/common/devCompileOptions.cmake
+++ b/test/common/devCompileOptions.cmake
@@ -1,184 +1,151 @@
#
-# Copyright 2021 Benjamin Worpitz, Bernhard Manfred Gruber
+# Copyright 2023 Benjamin Worpitz, Jeffrey Kelling, Bernhard Manfred Gruber, René Widera, Jan Stephan
# SPDX-License-Identifier: MPL-2.0
#
#-------------------------------------------------------------------------------
# Compiler settings.
#-------------------------------------------------------------------------------
-# By marking the boost headers as system headers, warnings produced within them are ignored.
-# Marking the boost headers as system headers does not work for nvcc (FindCUDA always uses -I)
-TARGET_INCLUDE_DIRECTORIES(
- "alpaka"
- SYSTEM
- INTERFACE ${Boost_INCLUDE_DIRS})
-
-IF(alpaka_ACC_GPU_CUDA_ENABLE AND (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA"))
- if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:-Wdefault-stream-launch -Werror=default-stream-launch>)
- endif()
+if(alpaka_ACC_GPU_CUDA_ENABLE AND (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA"))
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:-Wdefault-stream-launch -Werror=default-stream-launch>)
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3)
# supress error in Catch: 'error #177-D: variable "::autoRegistrar1" was declared but never referenced'
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:-Xcudafe=--diag_suppress=177>)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:-Xcudafe=--diag_suppress=177>)
endif()
-ENDIF()
+endif()
-#MSVC
-IF(MSVC)
- # Force to always compile with W4 and WX
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/W4> $<$:-Xcompiler=/W4>)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/WX> $<$:-Xcompiler=/W4>)
+if(MSVC)
+ # Force to always compile with W4
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/W4> $<$:-Xcompiler=/W4>)
+ if(alpaka_ENABLE_WERROR)
+ # WX treats warnings as errors
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/WX> $<$:-Xcompiler=/WX>)
+ endif()
# Improve debugging.
- IF(CMAKE_BUILD_TYPE MATCHES "Debug")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/Zo> $<$:-Xcompiler=/Zo>)
- ENDIF()
- IF(MSVC_VERSION GREATER 1900)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/permissive-> $<$:-Xcompiler=/permissive->)
- ENDIF()
- IF(MSVC_VERSION GREATER 1800)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/Zc:throwingNew> $<$:-Xcompiler=/Zc:throwingNew>)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/Zc:strictStrings> $<$:-Xcompiler=/Zc:strictStrings>)
- ENDIF()
-ELSE()
- IF(NOT(alpaka_ACC_GPU_CUDA_ENABLE) OR CMAKE_CUDA_COMPILER_ID STREQUAL "Clang"
- OR(alpaka_ACC_GPU_HIP_ENABLE AND HIP_PLATFORM MATCHES "nvcc"))
- # GNU
- IF(CMAKE_COMPILER_IS_GNUCXX)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wall")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wextra")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-pedantic")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Werror")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdouble-promotion")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wmissing-include-dirs")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconversion")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wunknown-pragmas")
- # Higher levels (max is 5) produce some strange warnings
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wstrict-overflow=2")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wtrampolines")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wfloat-equal")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wundef")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wshadow")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-qual")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-align")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wwrite-strings")
- # Too noisy as it warns for every operation using numeric types smaller then int.
- # Such values are converted to int implicitly before the calculation is done.
- # E.g.: uint16_t = uint16_t * uint16_t will trigger the following warning:
- # conversion to ‘short unsigned int’ from ‘int’ may alter its value
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconversion")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsign-conversion")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wvector-operation-performance")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wzero-as-null-pointer-constant")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdate-time")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wuseless-cast")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wlogical-op")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-aggressive-loop-optimizations")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wmissing-declarations")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-multichar")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wopenmp-simd")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wpacked")
- # Too much noise
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wpadded")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wredundant-decls")
- # Too much noise
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Winline")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdisabled-optimization")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-nonliteral")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-security")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-y2k")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wctor-dtor-privacy")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdelete-non-virtual-dtor")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wliteral-suffix")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnon-virtual-dtor")
- # This warns about members that have not explicitly been listed in the constructor initializer list.
- # This could be useful even for members that have a default constructor.
- # However, it also issues this warning for defaulted constructurs.
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Weffc++")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Woverloaded-virtual")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsign-promo")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconditionally-supported")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnoexcept")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wold-style-cast")
- IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-final-types")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-final-methods")
- # This does not work correctly as it suggests override to methods that are already marked with final.
- # Because final implies override, this is not useful.
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-override")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnormalized")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-signedness")
- ENDIF()
- IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnull-dereference")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wduplicated-cond")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsubobject-linkage")
- ENDIF()
- IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
- # This warning might be useful but it is triggered by comile-time code where it does not make any sense:
- # E.g. "Vec, TElem>" when both values are equal
- #LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wduplicated-branches")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Walloc-zero")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Walloca")
- ENDIF()
- IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-align=strict")
- ENDIF()
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$,$>:/Zo>
+ $<$,$>:-Xcompiler=/Zo>)
+
+ # Flags added in Visual Studio 2013
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/Zc:throwingNew> $<$:-Xcompiler=/Zc:throwingNew>)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/Zc:strictStrings> $<$:-Xcompiler=/Zc:strictStrings>)
+
+ # Flags added in Visual Studio 2015
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS $<$:/permissive-> $<$:-Xcompiler=/permissive->)
+endif()
+
+if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wall")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wextra")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-pedantic")
+ if(alpaka_ENABLE_WERROR)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Werror")
+ endif()
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdouble-promotion")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wmissing-include-dirs")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconversion")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wunknown-pragmas")
+ # Higher levels (max is 5) produce some strange warnings
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wstrict-overflow=2")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wtrampolines")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wfloat-equal")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wundef")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wshadow")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-qual")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-align")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wwrite-strings")
+ # Too noisy as it warns for every operation using numeric types smaller than int.
+ # Such values are converted to int implicitly before the calculation is done.
+ # E.g.: uint16_t = uint16_t * uint16_t will trigger the following warning:
+ # conversion to ‘short unsigned int’ from ‘int’ may alter its value
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconversion")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsign-conversion")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wvector-operation-performance")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wzero-as-null-pointer-constant")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdate-time")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wuseless-cast")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wlogical-op")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-aggressive-loop-optimizations")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wmissing-declarations")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-multichar")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wopenmp-simd")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wpacked")
+ # Too much noise
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wpadded")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wredundant-decls")
+ # Too much noise
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Winline")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdisabled-optimization")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-nonliteral")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-security")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-y2k")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wctor-dtor-privacy")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wdelete-non-virtual-dtor")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wliteral-suffix")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnon-virtual-dtor")
+ # This warns about members that have not explicitly been listed in the constructor initializer list.
+ # This could be useful even for members that have a default constructor.
+ # However, it also issues this warning for defaulted constructurs.
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Weffc++")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Woverloaded-virtual")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsign-promo")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wconditionally-supported")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnoexcept")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wold-style-cast")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-final-types")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-final-methods")
+ # This does not work correctly as it suggests override to methods that are already marked with final.
+ # Because final implies override, this is not useful.
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsuggest-override")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnormalized")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wformat-signedness")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wnull-dereference")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wduplicated-cond")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wsubobject-linkage")
+ # This warning might be useful but it is triggered by compile-time code where it does not make any sense:
+ # E.g. "Vec, TElem>" when both values are equal
+ #list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wduplicated-branches")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Walloc-zero")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Walloca")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wcast-align=strict")
+endif()
- # Clang, AppleClang, ICPX
- ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Werror")
- # Weverything really means everything (including Wall, Wextra, pedantic, ...)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Weverything")
- # We are not C++98 compatible
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-c++98-compat")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-c++98-compat-pedantic")
- # The following warnings are triggered by all instantiations of BOOST_AUTO_TEST_SUITE
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-disabled-macro-expansion")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-global-constructors")
- # This padding warning is generated by the execution tasks depending on the argument types
- # as they are stored as members. Therefore, the padding warning is triggered by the calling code
- # and does not indicate a failure within alpaka.
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-padded")
- # Triggers for all instances of alpaka_DEBUG_MINIMAL_LOG_SCOPE and similar macros followed by semicolon
- IF(CLANG_VERSION_MAJOR GREATER 7)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-extra-semi-stmt")
- ENDIF()
- IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-poison-system-directories")
- ENDIF()
- IF(alpaka_ACC_GPU_HIP_ENABLE)
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-unused-command-line-argument")
- IF(HIP_VERSION VERSION_LESS_EQUAL 5.3)
- # avoid error:
- # rocrand/rocrand_common.h:73:6: error: "Disabled inline asm, because
- # the build target does not support it." [-Werror,-W#warnings]
- # #warning "Disabled inline asm, because the build target does not support it."
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-error=#warnings")
- ENDIF()
- ENDIF()
+# Clang, AppleClang, ICPX
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
+ if(alpaka_ENABLE_WERROR)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Werror")
+ endif()
+ # Weverything really means everything (including Wall, Wextra, pedantic, ...)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Weverything")
+ # We are not C++98 compatible
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-c++98-compat")
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-c++98-compat-pedantic")
+ # Triggered by inline constants
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-global-constructors")
+ # This padding warning is generated by the execution tasks depending on the argument types
+ # as they are stored as members. Therefore, the padding warning is triggered by the calling code
+ # and does not indicate a failure within alpaka.
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-padded")
+ # Triggers for all instances of alpaka_DEBUG_MINIMAL_LOG_SCOPE and similar macros followed by semicolon
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-extra-semi-stmt")
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-poison-system-directories")
+ endif()
+
+ if(alpaka_ACC_GPU_HIP_ENABLE)
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-unused-command-line-argument")
+ if(HIP_VERSION VERSION_LESS_EQUAL 5.3)
+ # avoid error:
+ # rocrand/rocrand_common.h:73:6: error: "Disabled inline asm, because
+ # the build target does not support it." [-Werror,-W#warnings]
+ # #warning "Disabled inline asm, because the build target does not support it."
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wno-error=#warnings")
+ endif()
+ endif()
+
+ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM")
+ # fast math is turned on by default with ICPX, which breaks our unit tests
+ list(APPEND alpaka_DEV_COMPILE_OPTIONS "-ffp-model=precise")
+ endif()
+endif()
- SET(IS_ICPX OFF)
- IF(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
- SET(IS_ICPX ON)
- ELSEIF (CMAKE_VERSION VERSION_LESS 3.20 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- INCLUDE(CheckCXXSourceCompiles)
- CHECK_CXX_SOURCE_COMPILES("\
- #ifndef __INTEL_LLVM_COMPILER\
- # error\
- #endif
- int main() {}"
- IS_ICPX)
- ENDIF()
- IF (IS_ICPX)
- # fast math is turned on by default with ICPX, which breaks our unit tests
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-ffp-model=precise")
- ENDIF()
- # ICPC
- ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Wall")
- # PGI
- ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "PGI")
- LIST(APPEND alpaka_DEV_COMPILE_OPTIONS "-Minform=inform")
- ENDIF()
- ENDIF()
-ENDIF()