Skip to content

Commit

Permalink
CI job generator: define in the version.py which backend combinations…
Browse files Browse the repository at this point in the history
… should be tested

- Before, the backends was enabled depending on the host and device compiler.
- For each host device compiler combination only one backend combination was possible.
- Now, the backend combinations are defined in the versions.py and each combination can be combined with a host device compiler combination, if no filter rule forbid it.
- Add filter rule to disable OpenMP for Clang-CUDA.
  • Loading branch information
SimeonEhrig authored and j-stephan committed Aug 31, 2023
1 parent 3f919b8 commit af4e30b
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 41 deletions.
19 changes: 17 additions & 2 deletions script/job_generator/alpaka_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

from alpaka_job_coverage.globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from alpaka_globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from alpaka_job_coverage.util import row_check_name, row_check_version, is_in_row
from alpaka_job_coverage.util import (
row_check_name,
row_check_version,
is_in_row,
row_check_backend_version,
)


def alpaka_post_filter(row: List) -> bool:
Expand All @@ -22,7 +27,7 @@ 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)
Expand All @@ -40,4 +45,14 @@ def alpaka_post_filter(row: List) -> bool:
):
return False

# OpenMP is not supported for clang as cuda compiler
# https://github.com/alpaka-group/alpaka/issues/639
if row_check_name(row, DEVICE_COMPILER, "==", CLANG_CUDA) and (
row_check_backend_version(row, ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE, "==", ON_VER)
or row_check_backend_version(
row, ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE, "==", ON_VER
)
):
return False

return True
45 changes: 24 additions & 21 deletions script/job_generator/generate_job_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ def verify_image(
return "".join(verified_container_url)


@typechecked
def append_backend_variables(
variables: Dict[str, str], job: Dict[str, Tuple[str, str]]
):
"""Searches for enabled back-ends in the job parameters and appends the back-end
variable to variables to enable it in the CI job.
Args:
variables (Dict[str, str]): variables of the CI job
job (Dict[str, Tuple[str, str]]): job with parameters from the pair-wise
generator.
"""
for backend in BACKENDS_LIST:
if backend in job:
variables[backend] = "ON"


@typechecked
def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
"""Add variables to the job depending of the job dict.
Expand Down Expand Up @@ -270,14 +287,12 @@ 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]

# TODO(SimeonEhrig) at the moment, not all backends are available in
# versions.sw_versions[BACKENDS], therefore we have to set each backend explicit
# Later, we can iterate over versions.sw_versions[BACKENDS] and check, if a Backend needs to be
# enabled
# all back-ends are disabled by default
# back-ends are conditionally enabled depending on the job parameters
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE] = "OFF"
variables[ALPAKA_ACC_GPU_CUDA_ENABLE] = "OFF"
Expand All @@ -290,8 +305,9 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
else:
variables["ALPAKA_TEST_MDSPAN"] = "OFF"

append_backend_variables(variables, job)

if job[DEVICE_COMPILER][NAME] == HIPCC:
variables[ALPAKA_ACC_GPU_HIP_ENABLE] = "ON"
variables["CC"] = "clang"
variables["CXX"] = "clang++"
variables["GPU_TARGETS"] = "${CI_GPU_ARCH}"
Expand Down Expand Up @@ -322,7 +338,6 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
ALPAKA_ACC_GPU_CUDA_ENABLE in job
and job[ALPAKA_ACC_GPU_CUDA_ENABLE][VERSION] != OFF_VER
):
variables[ALPAKA_ACC_GPU_CUDA_ENABLE] = "ON"
variables["ALPAKA_CI_STDLIB"] = "libstdc++"
variables["CMAKE_CUDA_ARCHITECTURES"] = job[SM_LEVEL][VERSION]
variables["ALPAKA_CI_CUDA_VERSION"] = job[ALPAKA_ACC_GPU_CUDA_ENABLE][VERSION]
Expand All @@ -336,16 +351,11 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
variables["CC"] = "gcc"
variables["CXX"] = "g++"
variables["ALPAKA_CI_GCC_VER"] = job[HOST_COMPILER][VERSION]
variables[ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE] = "ON"
# configuration, if Clang is the CUDA host compiler
elif job[HOST_COMPILER][NAME] == CLANG:
variables["CC"] = "clang"
variables["CXX"] = "clang++"
variables["ALPAKA_CI_CLANG_VER"] = job[HOST_COMPILER][VERSION]
variables[ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "ON"
else:
raise RuntimeError(
"generate_job_yaml.job_variables(): unknown CUDA host compiler: "
Expand All @@ -357,9 +367,6 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
variables["CXX"] = "clang++"
variables["ALPAKA_CI_CLANG_VER"] = job[DEVICE_COMPILER][VERSION]
variables["CMAKE_CUDA_COMPILER"] = "clang++"
variables[ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE] = "ON"
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE] = "OFF"

# oneAPI configuration
if job[DEVICE_COMPILER][NAME] == ICPX:
Expand All @@ -371,12 +378,8 @@ def job_variables(job: Dict[str, Tuple[str, str]]) -> Dict[str, str]:
variables["ALPAKA_CI_CLANG_VER"] = "16"
variables["ALPAKA_CI_STDLIB"] = "libstdc++"
variables["ALPAKA_CI_ONEAPI_VERSION"] = job[DEVICE_COMPILER][VERSION]
variables[ALPAKA_ACC_SYCL_ENABLE] = "ON"
variables["alpaka_SYCL_ONEAPI_CPU"] = "ON"
variables["alpaka_SYCL_ONEAPI_CPU_ISA"] = "avx2"
variables[ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE] = "OFF" # Turn off OpenMP back-ends until Intel fixes https://github.com/intel/llvm/issues/10711
variables[ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE] = "OFF"
variables[ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE] = "ON"

return variables

Expand Down Expand Up @@ -410,7 +413,7 @@ def job_tags(job: Dict[str, Tuple[str, str]]) -> List[str]:
and job[ALPAKA_ACC_SYCL_ENABLE][VERSION] != OFF_VER
):
return ["x86_64", "cpuonly"]

# fallback
return ["x86_64", "cpuonly"]

Expand Down Expand Up @@ -448,7 +451,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"
variables["alpaka_ENABLE_WERROR"] = "ON"

return variables

Expand Down
2 changes: 1 addition & 1 deletion script/job_generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
alpaka-job-coverage == 1.5.2
alpaka-job-coverage == 1.5.3
allpairspy == 2.5.0
typeguard < 3.0.0
pyaml
Expand Down
76 changes: 59 additions & 17 deletions script/job_generator/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from alpaka_globals import * # pylint: disable=wildcard-import,unused-wildcard-import


# TODO: only an example
sw_versions: Dict[str, List[str]] = {
GCC: ["9", "10", "11", "12", "13"],
CLANG: ["9", "10", "11", "12", "13", "14", "15", "16"],
Expand All @@ -30,11 +29,40 @@
],
HIPCC: ["5.0", "5.1", "5.2", "5.3", "5.4", "5.5"],
ICPX: ["2023.1.0", "2023.2.0"],
# Contains all enabled back-ends.
# There are special cases for ALPAKA_ACC_GPU_CUDA_ENABLE and ALPAKA_ACC_GPU_HIP_ENABLE
# which have to be combined with nvcc and hipcc versions.
BACKENDS: [
# ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE,
ALPAKA_ACC_GPU_CUDA_ENABLE,
ALPAKA_ACC_GPU_HIP_ENABLE,
ALPAKA_ACC_SYCL_ENABLE,
# ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE,
# nvcc
[
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE,
ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE,
ALPAKA_ACC_GPU_CUDA_ENABLE,
],
# clang-cuda
# OpenMP is not supported for clang as cuda compiler
# https://github.com/alpaka-group/alpaka/issues/639
# therefore a extra combination is required
[
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE,
ALPAKA_ACC_GPU_CUDA_ENABLE,
],
# hip
[
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_GPU_HIP_ENABLE,
],
# sycl (oneAPI)
# Turn off OpenMP back-ends until Intel fixes https://github.com/intel/llvm/issues/10711
[
ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE,
ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE,
ALPAKA_ACC_SYCL_ENABLE,
],
],
UBUNTU: ["20.04"],
CMAKE: ["3.22.6", "3.23.5", "3.24.4", "3.25.3", "3.26.4"],
Expand Down Expand Up @@ -85,24 +113,38 @@ def get_compiler_versions(clang_cuda: bool = True) -> List[Tuple[str, str]]:

@typechecked
def get_backend_matrix() -> List[List[Tuple[str, str]]]:
"""Generate backend list, where only backend is active on the same time.
"""Generates a back-end list which contains different combinations of enabled back-ends.
Returns:
List[List[Tuple[str, str]]]: The backend list.
"""
combination_matrix: List[List[Tuple[str, str]]] = []

# TODO(SimeonEhrig) only working for HIP in the moment
if HIPCC in sw_versions:
for rocm_version in sw_versions[HIPCC]:
combination_matrix.append([(ALPAKA_ACC_GPU_HIP_ENABLE, rocm_version)])

if NVCC in sw_versions:
for cuda_version in sw_versions[NVCC]:
combination_matrix.append([(ALPAKA_ACC_GPU_CUDA_ENABLE, cuda_version)])

if ICPX in sw_versions:
combination_matrix.append([(ALPAKA_ACC_SYCL_ENABLE, ON_VER)])
for backend_list in sw_versions[BACKENDS]:
combination: List[Tuple[str, str]] = []
# all back-ends except ALPAKA_ACC_GPU_HIP_ENABLE and
# ALPAKA_ACC_GPU_CUDA_ENABLE can be enabled without having a version number attached to them
for backend_name in backend_list:
if backend_name not in [
ALPAKA_ACC_GPU_HIP_ENABLE,
ALPAKA_ACC_GPU_CUDA_ENABLE,
]:
combination.append((backend_name, ON_VER))

# add a back-end entry for each CUDA SDK version
if ALPAKA_ACC_GPU_CUDA_ENABLE in backend_list:
for cuda_version in sw_versions[NVCC]:
combination_copy = combination[:]
combination_copy.append((ALPAKA_ACC_GPU_CUDA_ENABLE, cuda_version))
combination_matrix.append(combination_copy)
# add a back-end entry for each HIP SDK version
elif ALPAKA_ACC_GPU_HIP_ENABLE in backend_list:
for rocm_version in sw_versions[HIPCC]:
combination_copy = combination[:]
combination_copy.append((ALPAKA_ACC_GPU_HIP_ENABLE, rocm_version))
combination_matrix.append(combination_copy)
else:
combination_matrix.append(combination)

return combination_matrix

Expand Down

0 comments on commit af4e30b

Please sign in to comment.