Skip to content
Draft
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
1 change: 1 addition & 0 deletions script/ci/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CMAKE_ARGS=(
-Dalpaka_FAST_MATH=OFF
"-DCMAKE_CXX_COMPILER=$APCI_CXX_COMPILER"
-Dalpaka_SIMD="${APCI_SIMD}"
-Dalpaka_CLANG_TIDY="${APCI_CLANG_TIDY}"
)

declare -A ap_deps=(
Expand Down
18 changes: 13 additions & 5 deletions script/ci/install/clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,22 @@ if [[ "$compiler_name" == "clang" && "$APCI_HIP" == 0 ]]; then
echo_run add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"
;;
esac

clang_apt_package_list=(
"clang-${compiler_version}"
"libomp-${compiler_version}-dev"
"clang-tools-${compiler_version}"
"libclang-rt-${compiler_version}-dev"
)

if [[ "${APCI_CLANG_TIDY}" == "ON" ]]; then
clang_apt_package_list+=("clang-tidy-${compiler_version}")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if this apt package is enough.

It installs the executable clang-tidy-<version> (e.g. clang-tidy-21). Maybe we need to create the file link clang-tidy, which points to clang-tidy-<version>, that CMake can find it.

fi

DEBIAN_FRONTEND=noninteractive retry_cmd apt update
# clang-tools is required, that CMake can setup clang as CUDA compiler
# libclang-rt is required for the sanitizer
quiet_run sudo DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
"clang-${compiler_version}" \
"libomp-${compiler_version}-dev" \
"clang-tools-${compiler_version}" \
"libclang-rt-${compiler_version}-dev"
quiet_run sudo DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y "${clang_apt_package_list[@]}"

export APCI_CXX_COMPILER="/usr/bin/clang++-${compiler_version}"
fi
Expand Down
4 changes: 4 additions & 0 deletions script/ci/utils/setup_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ if [[ -n ${GITHUB_ACTIONS+x} ]]; then
export APCI_SIMD=DEFAULT
fi

if [[ -z ${APCI_CLANG_TIDY+x} ]]; then
export APCI_CLANG_TIDY=OFF
fi

if [[ -z ${APCI_OMP+x} ]]; then
# if no other backend is enabled, use OpenMP
if [[ "$APCI_HIP" == 0 && "$APCI_ONEAPI" == 0 && "$APCI_CUDA" == 0 && "$APCI_TBB" == "OFF" ]]; then
Expand Down
1 change: 1 addition & 0 deletions script/job_generator/src/alpaka_bashi/ci_yaml/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def set_generic_variables(variables: dict[str, Any], combination: bashi.Combinat
variables["APCI_ALPAKA_ROOT"] = "$CI_PROJECT_DIR"
variables["APCI_ONEAPI_TARGET"] = "none"
variables["APCI_SIMD"] = "DEFAULT"
variables["APCI_CLANG_TIDY"] = "OFF"

dependencies = ["APCI_OMP", "APCI_TBB"]
gpu_dependencies = ["APCI_CUDA", "APCI_HIP", "APCI_ONEAPI"]
Expand Down
8 changes: 8 additions & 0 deletions script/job_generator/src/alpaka_bashi/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from alpaka_bashi.ci_yaml.misc import get_dummy_job
from alpaka_bashi.ci_yaml.names import get_job_name
from alpaka_bashi.globals import CI_PIPELINE_NAME, get_version_aliases
from alpaka_bashi.jobs_builder.clang_tidy import get_clang_tidy_job
from alpaka_bashi.jobs_builder.default import construct_job_yaml
from alpaka_bashi.jobs_builder.emulated_simd import get_emulated_simd_job
from alpaka_bashi.jobs_builder.sanitizer import SanitizerType, get_sanitizer_job
Expand Down Expand Up @@ -171,6 +172,13 @@ def get_special_jobs(
image_check=image_check,
)

special_jobs |= get_clang_tidy_job(
compiler_version=packaging.version.parse("21"),
container_version=container_version,
stage_name=stage_name,
image_check=image_check,
)

if job_filter:
compiled_regex = re.compile(job_filter)
special_jobs = {
Expand Down
88 changes: 88 additions & 0 deletions script/job_generator/src/alpaka_bashi/jobs_builder/clang_tidy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""Copyright 2026 Simeon Ehrig
SPDX-License-Identifier: MPL-2.0

Generates Clang Tidy GitLab CI jobs.
"""

# The linter error is triggered by manually defining a combination
# pylint: disable=duplicate-code

from typing import Any

import bashi
from bashi.globals import (
ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE,
ALPAKA_ACC_GPU_CUDA_ENABLE,
ALPAKA_ACC_GPU_HIP_ENABLE,
ALPAKA_ACC_ONEAPI_CPU_ENABLE,
ALPAKA_ACC_ONEAPI_GPU_ENABLE,
CLANG,
CMAKE,
CXX_STANDARD,
DEVICE_COMPILER,
HOST_COMPILER,
OFF,
ON,
UBUNTU,
)

from alpaka_bashi.globals import (
BUILD_TYPE,
CI_PIPELINE_NAME,
CI_PIPELINE_SPECIAL_VER,
CMAKE_DEBUG,
HWLOC,
JOB_EXECUTION_RUNTIME,
JOB_EXECUTION_TYPE,
)
from alpaka_bashi.jobs_builder.default import construct_job_yaml


def get_clang_tidy_job(
compiler_version: bashi.ValueVersion,
container_version: str,
stage_name: str,
image_check: bool,
) -> dict[str, Any]:
"""
Create a GitLab CI job where APCI_SIMD=EMULATION is set.

Args:
compiler_version (bashi.ValueVersion): Name of the used compiler.
container_version (str): Container version
stage_name (str): Stage name. If empty do not set an stage property.
image_check (bool): Check if image exist. If not, use fallback image.

Returns:
dict[str, Any]: Description.
"""
job_body = construct_job_yaml(
combination=bashi.parse_combination(
[
(HOST_COMPILER, CLANG, compiler_version),
(DEVICE_COMPILER, CLANG, compiler_version),
(CMAKE, "3.30.3"),
(UBUNTU, "24.04"),
(CXX_STANDARD, 20),
(BUILD_TYPE, CMAKE_DEBUG),
(JOB_EXECUTION_TYPE, JOB_EXECUTION_RUNTIME),
(CI_PIPELINE_NAME, CI_PIPELINE_SPECIAL_VER),
(ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE, ON),
(ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE, OFF),
(ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE, ON),
(ALPAKA_ACC_GPU_CUDA_ENABLE, OFF),
(ALPAKA_ACC_GPU_HIP_ENABLE, OFF),
(ALPAKA_ACC_ONEAPI_CPU_ENABLE, OFF),
(ALPAKA_ACC_ONEAPI_GPU_ENABLE, OFF),
(HWLOC, ON),
]
),
stage=stage_name,
container_version=container_version,
image_check=image_check,
)
job_body["variables"]["APCI_CLANG_TIDY"] = "ON"

return {f"linux_clang_{compiler_version}_clang_tidy": job_body}
Loading