Skip to content

Commit

Permalink
switch to C++20 only
Browse files Browse the repository at this point in the history
- remove support for C++17
- increase required CMake version to 3.25+
- remove `boost::atomic_ref usage`
- update documention
  • Loading branch information
psychocoderHPC committed Sep 30, 2024
1 parent e20236d commit bbf6271
Show file tree
Hide file tree
Showing 45 changed files with 82 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ env:
ALPAKA_CI_ONEAPI_VERSION: 2024.0
ALPAKA_CI_TBB_VERSION: 2021.10.0
ALPAKA_CI_RUN_TESTS: ON
alpaka_CXX_STANDARD: 17
alpaka_CXX_STANDARD: 20
alpaka_ACC_CPU_B_SEQ_T_SEQ_ENABLE: ON
alpaka_ACC_CPU_B_SEQ_T_THREADS_ENABLE: ON
alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: ON
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "alpaka: Abstraction Library for Parallel Kernel Acceleration",
"description": "The alpaka library is a header-only C++17 abstraction library for accelerator development. Its aim is to provide performance portability across accelerators through the abstraction (not hiding!) of the underlying levels of parallelism.",
"description": "The alpaka library is a header-only C++20 abstraction library for accelerator development. Its aim is to provide performance portability across accelerators through the abstraction (not hiding!) of the underlying levels of parallelism.",
"creators": [
{
"name": "Bocci, Andrea",
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

cmake_policy(SET CMP0091 NEW)

Expand All @@ -25,7 +25,7 @@ string(REGEX MATCH "([0-9]+)" alpaka_VERSION_PATCH ${alpaka_VERSION_PATCH_HPP})
set(PACKAGE_VERSION "${alpaka_VERSION_MAJOR}.${alpaka_VERSION_MINOR}.${alpaka_VERSION_PATCH}")

project(alpaka VERSION ${alpaka_VERSION_MAJOR}.${alpaka_VERSION_MINOR}.${alpaka_VERSION_PATCH}
DESCRIPTION "The alpaka library is a header-only C++17 abstraction library for accelerator development."
DESCRIPTION "The alpaka library is a header-only C++20 abstraction library for accelerator development."
HOMEPAGE_URL "https://github.com/alpaka-group/alpaka"
LANGUAGES CXX)

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

![alpaka](docs/logo/alpaka_401x135.png)

The **alpaka** library is a header-only C++17 abstraction library for accelerator development.
The **alpaka** library is a header-only C++20 abstraction library for accelerator development.

Its aim is to provide performance portability across accelerators through the abstraction (not hiding!) of the underlying levels of parallelism.

Expand Down Expand Up @@ -49,21 +49,21 @@ The [source code documentation](https://alpaka-group.github.io/alpaka/) is gener
Accelerator Back-ends
---------------------

| Accelerator Back-end | Lib/API | Devices | Execution strategy grid-blocks | Execution strategy block-threads |
|------------------------|---------------------------------------------------------|------------------------|------------------------------------|--------------------------------------|
| Accelerator Back-end | Lib/API | Devices | Execution strategy grid-blocks | Execution strategy block-threads |
|------------------------|---------------------------------------------------------|-----------------------|------------------------------------|--------------------------------------|
| Serial | n/a | Host CPU (single core) | sequential | sequential (only 1 thread per block) |
| OpenMP 2.0+ blocks | OpenMP 2.0+ | Host CPU (multi core) | parallel (preemptive multitasking) | sequential (only 1 thread per block) |
| OpenMP 2.0+ threads | OpenMP 2.0+ | Host CPU (multi core) | sequential | parallel (preemptive multitasking) |
| std::thread | std::thread | Host CPU (multi core) | sequential | parallel (preemptive multitasking) |
| TBB | TBB 2.2+ | Host CPU (multi core) | parallel (preemptive multitasking) | sequential (only 1 thread per block) |
| CUDA | CUDA 9.0+ | NVIDIA GPUs | parallel (undefined) | parallel (lock-step within warps) |
| HIP(clang) | [HIP 5.1+](https://github.com/ROCm-Developer-Tools/HIP) | AMD GPUs | parallel (undefined) | parallel (lock-step within warps) |
| OpenMP 2.0+ blocks | OpenMP 2.0+ | Host CPU (multi core) | parallel (preemptive multitasking) | sequential (only 1 thread per block) |
| OpenMP 2.0+ threads | OpenMP 2.0+ | Host CPU (multi core) | sequential | parallel (preemptive multitasking) |
| std::thread | std::thread | Host CPU (multi core) | sequential | parallel (preemptive multitasking) |
| TBB | TBB 2.2+ | Host CPU (multi core) | parallel (preemptive multitasking) | sequential (only 1 thread per block) |
| CUDA | CUDA 12.0+ | NVIDIA GPUs | parallel (undefined) | parallel (lock-step within warps) |
| HIP(clang) | [HIP 6.0+](https://github.com/ROCm-Developer-Tools/HIP) | AMD GPUs | parallel (undefined) | parallel (lock-step within warps) |


Supported Compilers
-------------------

This library uses C++17 (or newer when available).
This library uses C++20 (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) | clang 17 (Linux) | clang 18 (Linux) | clang 19 (Linux) | icpx 2024.2 (Linux) | Xcode 13.2.1 / 14.2 / 14.3.1 (macOS) | Visual Studio 2022 (Windows) |
|----------------------|-------------------------------------------|-------------------------------------------|---------------------------------------|---------------------------------------|-------------------------------------------|-------------------------------------------------|-------------------------------------------|---------------------------------------|---------------------------------------|---------------------------------------|---------------------------------------|---------------------------------------|---------------------------------------|--------------------|-------------------------|--------------------------------------|------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Required CMake version.
################################################################################

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

project("alpakaBenchmarks" LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/babelstream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: ISC
#

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(babelstream LANGUAGES CXX)
Expand Down
45 changes: 3 additions & 42 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ endif()
set(alpaka_DEBUG "0" CACHE STRING "Debug level")
set_property(CACHE alpaka_DEBUG PROPERTY STRINGS "0;1;2")

set(alpaka_CXX_STANDARD_DEFAULT "17")
set(alpaka_CXX_STANDARD_DEFAULT "20")
# Check whether alpaka_CXX_STANDARD has already been defined as a non-cached variable.
if(DEFINED alpaka_CXX_STANDARD)
set(alpaka_CXX_STANDARD_DEFAULT ${alpaka_CXX_STANDARD})
endif()

set(alpaka_CXX_STANDARD ${alpaka_CXX_STANDARD_DEFAULT} CACHE STRING "C++ standard version")
set_property(CACHE alpaka_CXX_STANDARD PROPERTY STRINGS "17;20")
set_property(CACHE alpaka_CXX_STANDARD PROPERTY STRINGS "20")

if(NOT TARGET alpaka)
add_library(alpaka INTERFACE)
Expand Down Expand Up @@ -219,41 +219,6 @@ find_package(Boost ${_alpaka_BOOST_MIN_VER} REQUIRED

target_link_libraries(alpaka INTERFACE Boost::headers)

if(alpaka_ACC_CPU_B_SEQ_T_SEQ_ENABLE OR
alpaka_ACC_CPU_B_SEQ_T_THREADS_ENABLE OR
alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE OR
alpaka_ACC_CPU_B_OMP2_T_SEQ_ENABLE OR
alpaka_ACC_CPU_B_SEQ_T_OMP2_ENABLE)

if(NOT alpaka_ACC_CPU_DISABLE_ATOMIC_REF)
# Check for C++20 std::atomic_ref first
if(${alpaka_CXX_STANDARD} VERSION_GREATER_EQUAL "20")
try_compile(alpaka_HAS_STD_ATOMIC_REF # Result stored here
"${PROJECT_BINARY_DIR}/alpakaFeatureTests" # Binary directory for output file
SOURCES "${_alpaka_FEATURE_TESTS_DIR}/StdAtomicRef.cpp" # Source file
CXX_STANDARD 20
CXX_STANDARD_REQUIRED TRUE
CXX_EXTENSIONS FALSE)
if(alpaka_HAS_STD_ATOMIC_REF AND (NOT alpaka_ACC_CPU_DISABLE_ATOMIC_REF))
message(STATUS "std::atomic_ref<T> found")
target_compile_definitions(alpaka INTERFACE ALPAKA_HAS_STD_ATOMIC_REF)
else()
message(STATUS "std::atomic_ref<T> NOT found")
endif()
endif()

if(Boost_ATOMIC_FOUND AND (NOT alpaka_HAS_STD_ATOMIC_REF))
message(STATUS "boost::atomic_ref<T> found")
target_link_libraries(alpaka INTERFACE Boost::atomic)
endif()
endif()

if(alpaka_ACC_CPU_DISABLE_ATOMIC_REF OR ((NOT alpaka_HAS_STD_ATOMIC_REF) AND (NOT Boost_ATOMIC_FOUND)))
message(STATUS "atomic_ref<T> was not found or manually disabled. Falling back to lock-based CPU atomics.")
target_compile_definitions(alpaka INTERFACE ALPAKA_DISABLE_ATOMIC_ATOMICREF)
endif()
endif()

if(${alpaka_DEBUG} GREATER 1)
message(STATUS "Boost in:")
cmake_print_variables(BOOST_ROOT)
Expand Down Expand Up @@ -468,10 +433,6 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
message(STATUS "nvcc is used as CUDA compiler")

if(alpaka_CXX_STANDARD GREATER_EQUAL 20 AND CMAKE_VERSION VERSION_LESS "3.25.0")
message(FATAL_ERROR "CMake 3.24 and older does not support C++20 for nvcc")
endif()

# nvcc sets no linux/__linux macros on OpenPOWER linux
# nvidia bug id: 2448610
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
Expand All @@ -483,7 +444,7 @@ if(alpaka_ACC_GPU_CUDA_ENABLE)
if(alpaka_CUDA_EXPT_EXTENDED_LAMBDA STREQUAL ON)
alpaka_set_compiler_options(DEVICE target alpaka "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--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++20 many standard library functions we rely on are constexpr (std::min, std::multiplies, ...)
alpaka_set_compiler_options(DEVICE target alpaka "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--expt-relaxed-constexpr>")

# CMake automatically sets '-g' in debug mode
Expand Down
4 changes: 2 additions & 2 deletions docs/source/basic/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following example shows a minimal example of a ``CMakeLists.txt`` that uses
.. code-block:: cmake
:caption: CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)
project("myexample" CXX)
find_package(alpaka REQUIRED)
Expand Down Expand Up @@ -55,7 +55,7 @@ The ``add_subdirectory`` method does not require alpaka to be installed. Instead
.. code-block:: cmake
:caption: CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)
project("myexample" CXX)
add_subdirectory(thirdParty/alpaka)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/basic/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ If user is going to create her/his own project/example outside the source tree a
.. code-block::
# Clone alpaka from github.com
git clone --branch 1.1.0 https://github.com/alpaka-group/alpaka.git
git clone --branch 1.2.0 https://github.com/alpaka-group/alpaka.git
cd alpaka
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/install/ ..
Expand Down
2 changes: 1 addition & 1 deletion docs/source/basic/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Library Interface
As described in the chapter about the :doc:`Abstraction </basic/abstraction>`, the general design of the library is very similar to *CUDA* and *OpenCL* but extends both by some points, while not requiring any language extensions.
General interface design as well as interface implementation decisions differentiating *alpaka* from those libraries are described in the Rationale section.
It uses C++ because it is one of the most performant languages available on nearly all systems.
Furthermore, C++17 allows to describe the concepts in a very abstract way that is not possible with many other languages.
Furthermore, C++20 allows to describe the concepts in a very abstract way that is not possible with many other languages.
The *alpaka* library extensively makes use of advanced functional C++ template meta-programming techniques.
The Implementation Details section discusses the C++ library and the way it provides extensibility and optimizability.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"alpaka",
"Abstraction Library for Parallel Kernel Acceleration",
"""
The alpaka library is a header-only C++17 abstraction library for
The alpaka library is a header-only C++20 abstraction library for
accelerator development. Its aim is to provide performance portability
across accelerators through the abstraction (not hiding!) of the underlying
levels of parallelism.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev/details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ This functionality can be accessed by the corresponding ``alpaka::enqueue`` and

Currently there is no native language support for describing and checking concepts in C++ at compile time.
A study group (SG8) is working on the ISO `specification for concepts <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4377.pdf>`_ and compiler forks implementing them do exist.
For usage in current C++ there are libraries like `Boost.ConceptCheck <https://www.boost.org/doc/libs/1_58_0/libs/concept_check/concept_check.htm>`_ which try to emulate requirement checking of concept types.
For usage in current C++ there are libraries like `Boost.ConceptCheck <https://www.boost.org/doc/libs/1_74_0/libs/concept_check/concept_check.htm>`_ which try to emulate requirement checking of concept types.
Those libraries often exploit the preprocessor and require non-trivial changes to the function declaration syntax.
Therefore the *alpaka* library does not currently make use of *Boost.ConceptCheck*.
Neither does it facilitate the proposed concept specification due to its dependency on non-standard compilers.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

*alpaka - An Abstraction Library for Parallel Kernel Acceleration*

The alpaka library is a header-only C++17 abstraction library for accelerator development.
The alpaka library is a header-only C++20 abstraction library for accelerator development.
Its aim is to provide performance portability across accelerators through the abstraction (not hiding!) of the underlying levels of parallelism.

.. CAUTION::
Expand Down
2 changes: 1 addition & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Required CMake version.
################################################################################

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

project("alpakaExamples" LANGUAGES CXX)

Expand Down
2 changes: 1 addition & 1 deletion example/bufferCopy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/complex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/conv2DWithMdspan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/convolution1D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/convolution2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/counterBasedRng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/heatEquation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/heatEquation2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/helloWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/helloWorldLambda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/kernelSpecialization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/ls/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2023 Bernhard Manfred Gruber
# SPDX-License-Identifier: ISC

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(alpaka-ls LANGUAGES CXX)
Expand Down
2 changes: 1 addition & 1 deletion example/matrixMulWithMdspan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/monteCarloIntegration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/openMPSchedule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/parallelLoopPatterns/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
2 changes: 1 addition & 1 deletion example/randomCells2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
################################################################################
# Required CMake version.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.25)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down
Loading

0 comments on commit bbf6271

Please sign in to comment.