Skip to content

Commit

Permalink
set alpaka_CXX_STANDARD in the job generator
Browse files Browse the repository at this point in the history
- CI: disable C++20 in nvcc for CMake older than 3.25
- CI: install libstdc++-11 if C++ 20 is used in Clang based compiler
- CI: disable g++-12 for Ubuntu 20.04 because it not available in the ppa's
  • Loading branch information
SimeonEhrig authored and fwyzard committed Jul 10, 2024
1 parent 6ad09ba commit 995c57b
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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_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
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ generate:
- apk update && apk add python3~=3.11 py3-pip
- pip3 install -r script/job_generator/requirements.txt
# it is sufficient to verify once, as the same job matrix is generated, verified and then filtered each time
- python3 script/job_generator/job_generator.py ${ALPAKA_GITLAB_CI_GENERATOR_CONTAINER_VERSION} --verify --wave compile_only_job -o compile_only.yml
# disable verify because we know that the generator is broken: https://github.com/thombashi/allpairspy/pull/10
#- python3 script/job_generator/job_generator.py ${ALPAKA_GITLAB_CI_GENERATOR_CONTAINER_VERSION} --verify --wave compile_only_job -o compile_only.yml
- python3 script/job_generator/job_generator.py ${ALPAKA_GITLAB_CI_GENERATOR_CONTAINER_VERSION} --wave compile_only_job -o compile_only.yml
- python3 script/job_generator/job_generator.py ${ALPAKA_GITLAB_CI_GENERATOR_CONTAINER_VERSION} --wave runtime_job_cpu -o runtime_cpu.yml
- python3 script/job_generator/job_generator.py ${ALPAKA_GITLAB_CI_GENERATOR_CONTAINER_VERSION} --wave runtime_job_gpu -o runtime_gpu.yml
- cat compile_only.yml
Expand Down
4 changes: 4 additions & 0 deletions cmake/alpakaCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ 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 Down
1 change: 1 addition & 0 deletions script/gitlabci/job_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ linux_clang-14_debug_analysis:
CMAKE_BUILD_TYPE: Debug
ALPAKA_BOOST_VERSION: 1.80.0
ALPAKA_CI_CMAKE_VER: 3.23.5
alpaka_CXX_STANDARD: 17
ALPAKA_CI_ANALYSIS: "ON"
alpaka_DEBUG: 2
alpaka_ACC_CPU_B_TBB_T_SEQ_ENABLE: "OFF"
2 changes: 2 additions & 0 deletions script/gitlabci/job_clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ linux_clang-11_release:
ALPAKA_BOOST_VERSION: 1.75.0
ALPAKA_CI_CMAKE_VER: 3.22.6
CMAKE_CXX_EXTENSIONS: "OFF"
alpaka_CXX_STANDARD: 17

linux_clang-14_debug:
extends: .base_clang
Expand All @@ -18,6 +19,7 @@ linux_clang-14_debug:
CMAKE_BUILD_TYPE: Debug
ALPAKA_BOOST_VERSION: 1.80.0
ALPAKA_CI_CMAKE_VER: 3.23.5
alpaka_CXX_STANDARD: 17

linux_clang-16_relwithdebinfo_asan_c++20:
extends: .base_clang
Expand Down
2 changes: 2 additions & 0 deletions script/gitlabci/job_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ linux_nvcc12.0_gcc12_debug_relocatable_device_code_compile_only:
CMAKE_BUILD_TYPE: Debug
ALPAKA_BOOST_VERSION: 1.81.0
ALPAKA_CI_CMAKE_VER: 3.26.5
alpaka_CXX_STANDARD: 17
alpaka_RELOCATABLE_DEVICE_CODE: "ON"

linux_nvcc12.0_gcc12_release_extended_lambda_off_compile_only:
Expand All @@ -23,5 +24,6 @@ linux_nvcc12.0_gcc12_release_extended_lambda_off_compile_only:
CMAKE_BUILD_TYPE: Release
ALPAKA_BOOST_VERSION: 1.82.0
ALPAKA_CI_CMAKE_VER: 3.27.1
alpaka_CXX_STANDARD: 17
alpaka_ACC_GPU_CUDA_ENABLE: "ON"
alpaka_CUDA_EXPT_EXTENDED_LAMBDA: "OFF"
9 changes: 9 additions & 0 deletions script/install_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ then
fi
fi

# Workaround if clang uses the stdlibc++. The stdlibc++-9 does not support C++20, therefore we install the stdlibc++-11. Clang automatically uses the latest stdlibc++ version.
if [[ "$(cat /etc/os-release)" =~ "20.04" ]] && [ "${alpaka_CXX_STANDARD}" == "20" ];
then
travis_retry sudo apt install -y --no-install-recommends software-properties-common
sudo apt-add-repository ppa:ubuntu-toolchain-r/test -y
travis_retry sudo apt update
travis_retry sudo apt install -y --no-install-recommends g++-11
fi

if [ "${alpaka_ACC_CPU_B_OMP2_T_SEQ_ENABLE}" = "ON" ] || [ "${alpaka_ACC_CPU_B_SEQ_T_OMP2_ENABLE}" = "ON" ]
then
LIBOMP_PACKAGE=libomp-${ALPAKA_CI_CLANG_VER}-dev
Expand Down
9 changes: 9 additions & 0 deletions script/install_hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ export HSA_PATH=$ROCM_PATH
export PATH=${ROCM_PATH}/bin:$PATH
export PATH=${ROCM_PATH}/llvm/bin:$PATH

# Workaround if clang uses the stdlibc++. The stdlibc++-9 does not support C++20, therefore we install the stdlibc++-11. Clang automatically uses the latest stdlibc++ version.
if [[ "$(cat /etc/os-release)" =~ "20.04" ]] && [ "${alpaka_CXX_STANDARD}" == "20" ];
then
travis_retry sudo apt install -y --no-install-recommends software-properties-common
sudo apt-add-repository ppa:ubuntu-toolchain-r/test -y
travis_retry sudo apt update
travis_retry sudo apt install -y --no-install-recommends g++-11
fi

sudo update-alternatives --install /usr/bin/clang clang ${ROCM_PATH}/llvm/bin/clang 50
sudo update-alternatives --install /usr/bin/clang++ clang++ ${ROCM_PATH}/llvm/bin/clang++ 50
sudo update-alternatives --install /usr/bin/cc cc ${ROCM_PATH}/llvm/bin/clang 50
Expand Down
16 changes: 16 additions & 0 deletions script/job_generator/alpaka_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,20 @@ def alpaka_post_filter(row: List) -> bool:
):
return False

# cmake 3.24 and older does not support C++20 for nvcc
if (
row_check_name(row, DEVICE_COMPILER, "==", NVCC)
and row_check_version(row, CXX_STANDARD, ">=", "20")
and row_check_version(row, CMAKE, "<", "3.25")
):
return False

# g++-12 is not available on the Ubuntu 20.04 ppa's
if (
row_check_name(row, HOST_COMPILER, "==", GCC)
and row_check_version(row, HOST_COMPILER, "==", "12")
and row_check_version(row, UBUNTU, "==", "20.04")
):
return False

return True
1 change: 1 addition & 0 deletions script/job_generator/generate_job_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:

variables["ALPAKA_CI_CMAKE_VER"] = job[CMAKE][VERSION]
variables["ALPAKA_BOOST_VERSION"] = job[BOOST][VERSION]
variables["alpaka_CXX_STANDARD"] = job[CXX_STANDARD][VERSION]

# all back-ends are disabled by default
# back-ends are conditionally enabled depending on the job parameters
Expand Down
6 changes: 6 additions & 0 deletions script/run_generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

source ./script/set.sh

# TODO(SimeonEhrig): should use CMAKE_C_COMPILER and CMAKE_CXX_COMPILER instead update-alternatives because it
# is more relastic use case and less error prone approach
#: "${CMAKE_C_COMPILER?'CMAKE_C_COMPILER must be specified'}"
#: "${CMAKE_CXX_COMPILER?'CMAKE_CXX_COMPILER must be specified'}"
: "${alpaka_CXX_STANDARD?'alpaka_CXX_STANDARD must be specified'}"

#-------------------------------------------------------------------------------

# create a cmake variable definition if an environment variable exists
Expand Down

0 comments on commit 995c57b

Please sign in to comment.