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

filter rule: CMake <=3.18 does not support Clang-CUDA #49

Merged
merged 1 commit into from
Sep 9, 2024
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
17 changes: 16 additions & 1 deletion src/bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import packaging.version as pkv
from typeguard import typechecked
from bashi.types import ParameterValueTuple
from bashi.globals import DEVICE_COMPILER, HOST_COMPILER, GCC, UBUNTU
from bashi.globals import DEVICE_COMPILER, HOST_COMPILER, GCC, UBUNTU, CLANG_CUDA, CMAKE
from bashi.utils import reason


Expand Down Expand Up @@ -77,6 +77,7 @@ def software_dependency_filter(

# Rule: d1
# GCC 6 and older is not available in Ubuntu 20.04 and newer

if UBUNTU in row and row[UBUNTU].version >= pkv.parse("20.04"):
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
if compiler_type in row and row[compiler_type].name == GCC:
Expand All @@ -89,4 +90,18 @@ def software_dependency_filter(
)
return False

# Rule: d2
# 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):
if compiler_type in row and row[compiler_type].name == CLANG_CUDA:
reason(
output,
f"{__pretty_name_compiler(compiler_type)} CLANG_CUDA "
"is not available in CMAKE "
f"{row[CMAKE].version}",
)
return False

return True
20 changes: 20 additions & 0 deletions src/bashi/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def get_expected_bashi_parameter_value_pairs(
_remove_unsupported_gcc_versions_for_ubuntu2004(
param_val_pair_list, removed_param_val_pair_list
)
_remove_unsupported_cmake_versions_for_clangcuda(
param_val_pair_list, removed_param_val_pair_list
)
return (param_val_pair_list, removed_param_val_pair_list)


Expand Down Expand Up @@ -772,3 +775,20 @@ def _remove_unsupported_gcc_versions_for_ubuntu2004(
value_name2=UBUNTU,
value_version2="<20.04",
)


def _remove_unsupported_cmake_versions_for_clangcuda(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
remove_parameter_value_pairs(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=compiler_type,
value_name1=CLANG_CUDA,
value_version1=ANY_VERSION,
parameter2=CMAKE,
value_name2=CMAKE,
value_version2=">3.18",
)
56 changes: 56 additions & 0 deletions tests/test_filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,59 @@ def test_not_valid_gcc_is_in_ubuntu_2004_d1(self):
reason_msg.getvalue(),
f"device compiler GCC {gcc_version} is not available in Ubuntu 22.04",
)

def test_valid_cmake_versions_for_clangcuda_d2(self):
for cmake_version in ["3.19", "3.26", "3.20", "3.49"]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
HOST_COMPILER: ppv((CLANG_CUDA, 14)),
CMAKE: ppv((CMAKE, cmake_version)),
}
),
)
)

for cmake_version in ["3.19", "3.26", "3.20", "3.49"]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
DEVICE_COMPILER: ppv((CLANG_CUDA, 15)),
CMAKE: ppv((CMAKE, cmake_version)),
}
),
)
)

def test_not_valid_cmake_versions_for_clangcuda_d2(self):
for cmake_version in ["3.9", "3.11", "3.17", "3.18"]:
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(
OD({HOST_COMPILER: ppv((CLANG_CUDA, 14)), CMAKE: ppv((CMAKE, cmake_version))}),
reason_msg,
),
f"host compiler CLANG_CUDA + CMAKE {cmake_version}",
)
self.assertEqual(
reason_msg.getvalue(),
f"host compiler CLANG_CUDA is not available in CMAKE {cmake_version}",
)

for cmake_version in ["3.9", "3.11", "3.17", "3.18"]:
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(
OD(
{DEVICE_COMPILER: ppv((CLANG_CUDA, 15)), CMAKE: ppv((CMAKE, cmake_version))}
),
reason_msg,
),
f"device compiler CLANG_CUDA + CMAKE {cmake_version}",
)
self.assertEqual(
reason_msg.getvalue(),
f"device compiler CLANG_CUDA is not available in CMAKE {cmake_version}",
)
54 changes: 54 additions & 0 deletions tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
_remove_specific_cuda_clang_combinations,
_remove_unsupported_clang_sdk_versions_for_clang_cuda,
_remove_unsupported_gcc_versions_for_ubuntu2004,
_remove_unsupported_cmake_versions_for_clangcuda,
)
from bashi.versions import NvccHostSupport, NVCC_GCC_MAX_VERSION

Expand Down Expand Up @@ -2302,3 +2303,56 @@ def test_remove_unsupported_gcc_versions_for_ubuntu2004_and_later(self):
expected_results,
create_diff_parameter_value_pairs(test_param_value_pairs, expected_results),
)

def test_remove_unsupported_cmake_versions_for_clangcuda(self):
test_param_value_pairs: List[ParameterValuePair] = parse_expected_val_pairs(
[
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.19")}),
OD({HOST_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.20")}),
OD({HOST_COMPILER: (CLANG_CUDA, 15), CMAKE: (CMAKE, "3.18")}),
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.21")}),
OD({HOST_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.26")}),
OD({HOST_COMPILER: (CLANG_CUDA, 12), CMAKE: (CMAKE, "3.18")}),
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.46")}),
OD({HOST_COMPILER: (CLANG_CUDA, 12), CMAKE: (CMAKE, "3.1")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 12), CMAKE: (CMAKE, "3.18")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.19")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 15), CMAKE: (CMAKE, "3.20")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.14")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.12")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.9")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 17), CMAKE: (CMAKE, "3.19")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.17")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.26")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.30")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 16), CMAKE: (CMAKE, "3.40")}),
OD({HOST_COMPILER: (GCC, 12), UBUNTU: (UBUNTU, "22.04")}),
]
)
expected_results = parse_expected_val_pairs(
[
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.19")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.19")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 17), CMAKE: (CMAKE, "3.19")}),
OD({HOST_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.20")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.30")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 16), CMAKE: (CMAKE, "3.40")}),
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.21")}),
OD({HOST_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.26")}),
OD({HOST_COMPILER: (CLANG_CUDA, 14), CMAKE: (CMAKE, "3.46")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 15), CMAKE: (CMAKE, "3.20")}),
OD({DEVICE_COMPILER: (CLANG_CUDA, 13), CMAKE: (CMAKE, "3.26")}),
OD({HOST_COMPILER: (GCC, 12), UBUNTU: (UBUNTU, 22.04)}),
]
)
default_remove_test(
_remove_unsupported_cmake_versions_for_clangcuda,
test_param_value_pairs,
expected_results,
self,
)
self.assertEqual(
test_param_value_pairs,
expected_results,
create_diff_parameter_value_pairs(test_param_value_pairs, expected_results),
)
Loading