Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new filter rule(Ubuntu 20.04 does not support CUDA <10.2) #50

Merged
Merged
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
42 changes: 41 additions & 1 deletion src/bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from bashi.types import ParameterValueTuple
from bashi.globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from bashi.utils import reason
from bashi.versions import get_oldest_supporting_clang_version_for_cuda


def __ubuntu_version_to_string(version: pkv.Version) -> str:
Expand Down Expand Up @@ -74,6 +75,9 @@ def software_dependency_filter(
Returns:
bool: True, if parameter-value-tuple is valid.
"""
# pylint: disable=too-many-branches
# pylint: disable=too-many-return-statements
# pylint: disable=too-many-statements

# Rule: d1
# GCC 6 and older is not available in Ubuntu 20.04 and newer
Expand All @@ -91,7 +95,7 @@ def software_dependency_filter(
return False

# Rule: d2
# CMAKE 3.19 and older is not available with clang cuda as device and host compiler
# CMAKE 3.19 and older is not available with clang-cuda as device and host compiler

if CMAKE in row and row[CMAKE].version <= pkv.parse("3.18"):
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
Expand All @@ -116,4 +120,40 @@ def software_dependency_filter(
"older than 20.04",
)
return False

# Rule: d4
# Ubuntu 20.04 and newer is not available with CUDA older than 11

if UBUNTU in row and row[UBUNTU].version >= pkv.parse("20.04"):
if ALPAKA_ACC_GPU_CUDA_ENABLE in row and row[ALPAKA_ACC_GPU_CUDA_ENABLE].version != OFF_VER:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version < pkv.parse("11.0"):
reason(
output,
f"CUDA {row[ALPAKA_ACC_GPU_CUDA_ENABLE].version} "
"is not available in Ubuntu "
f"{__ubuntu_version_to_string(row[UBUNTU].version)}",
)
return False
if DEVICE_COMPILER in row and row[DEVICE_COMPILER].name == NVCC:
if row[DEVICE_COMPILER].version < pkv.parse("11.0"):
reason(
output,
f"NVCC {row[DEVICE_COMPILER].version} "
"is not available in Ubuntu "
f"{__ubuntu_version_to_string(row[UBUNTU].version)}",
)
return False
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
if compiler_type in row and row[compiler_type].name == CLANG_CUDA:
if row[compiler_type].version < get_oldest_supporting_clang_version_for_cuda(
"11.0"
):
reason(
output,
f"{__pretty_name_compiler(compiler_type)}"
f" clang-cuda {row[compiler_type].version} "
"is not available in Ubuntu "
f"{__ubuntu_version_to_string(row[UBUNTU].version)}",
)
return False
return True
47 changes: 47 additions & 0 deletions src/bashi/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def get_expected_bashi_parameter_value_pairs(
_remove_all_rocm_images_older_than_ubuntu2004_based(
param_val_pair_list, removed_param_val_pair_list
)
_remove_unsupported_cuda_versions_for_ubuntu(param_val_pair_list, removed_param_val_pair_list)
return (param_val_pair_list, removed_param_val_pair_list)


Expand Down Expand Up @@ -861,3 +862,49 @@ def _remove_all_rocm_images_older_than_ubuntu2004_based(
parameter2=compiler_type,
value_name2=HIPCC,
)


def _remove_unsupported_cuda_versions_for_ubuntu(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
remove_parameter_value_pairs_ranges(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_min_version1=20.04,
parameter2=ALPAKA_ACC_GPU_CUDA_ENABLE,
value_name2=ALPAKA_ACC_GPU_CUDA_ENABLE,
value_min_version2=OFF,
value_min_version2_inclusive=False,
value_max_version2=11,
value_max_version2_inclusive=False,
)
remove_parameter_value_pairs_ranges(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_min_version1=20.04,
parameter2=DEVICE_COMPILER,
value_name2=NVCC,
value_min_version2=OFF,
value_min_version2_inclusive=False,
value_max_version2=11,
value_max_version2_inclusive=False,
)
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
remove_parameter_value_pairs_ranges(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_min_version1=20.04,
parameter2=compiler_type,
value_name2=CLANG_CUDA,
value_min_version2=OFF,
value_min_version2_inclusive=False,
value_max_version2=12,
value_max_version2_inclusive=False,
)
30 changes: 30 additions & 0 deletions src/bashi/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,33 @@ def is_supported_version(name: ValueName, version: ValueVersion) -> bool:
return True

return False


def get_oldest_supporting_clang_version_for_cuda(
cuda_version: str,
clang_cuda_max_cuda_version: List[ClangCudaSDKSupport] = copy.deepcopy(
CLANG_CUDA_MAX_CUDA_VERSION
),
) -> packaging.version.Version:
"""Returns the first and oldest Clang-CUDA version which supports a given CUDA version.
Args:
cuda_version (str): CUDA SKD version
clang_cuda_max_cuda_version (List[ClangCudaSDKSupport], optional): List Clang version with
the maximum supported CUDA SDK version. Defaults to CLANG_CUDA_MAX_CUDA_VERSION.
Returns:
packaging.version.Version: Returns the first and oldest Clang version which supports the
given CUDA SDK version. Returns version 0, if no version supports the CUDA SDK.
"""
parsed_cuda_ver = pkv.parse(cuda_version)
# sort the list by the Clang version starting the smallest version
# luckily we can assume that the CUDA SDK version is also sorted starting with the smallest
# version, because a newer Clang version will also support all version like before plus new
# versions
clang_cuda_max_cuda_version.sort()

for sdk_support in clang_cuda_max_cuda_version:
if sdk_support.cuda >= parsed_cuda_ver:
return sdk_support.clang_cuda

# return version 0 as not available
return OFF_VER
Loading
Loading