Skip to content

Commit

Permalink
Fixing merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriiPerets committed Sep 19, 2024
1 parent f3a421a commit 164477f
Show file tree
Hide file tree
Showing 4 changed files with 415 additions and 0 deletions.
36 changes: 36 additions & 0 deletions 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 CLANG_CUDA_MAX_CUDA_VERSION


def __ubuntu_version_to_string(version: pkv.Version) -> str:
Expand Down Expand Up @@ -117,3 +118,38 @@ def software_dependency_filter(
)
return False
return True

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

"""
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("10.2"):
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 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"):
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"):
return False
for compiler in (HOST_COMPILER, DEVICE_COMPILER):
if compiler in row and row[compiler].name == CLANG_CUDA:
if row[compiler].version < CLANG_CUDA_MAX_CUDA_VERSION[3].clang_cuda:
return False
39 changes: 39 additions & 0 deletions src/bashi/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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 @@ -827,3 +828,41 @@ def _remove_all_rocm_images_older_than_ubuntu2004_based(
value_name2=HIPCC,
value_version2=ANY_VERSION,
)


def _remove_unsupported_cuda_versions_for_ubuntu(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
remove_parameter_value_pairs(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_version1="<20.04",
parameter2=ALPAKA_ACC_GPU_CUDA_ENABLE,
value_name2=ALPAKA_ACC_GPU_CUDA_ENABLE,
value_version2=">11",
)

remove_parameter_value_pairs(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_version1="<20.04",
parameter2=DEVICE_COMPILER,
value_name2=NVCC,
value_version2=">11",
)
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
remove_parameter_value_pairs(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_version1="<20.04",
parameter2=compiler_type,
value_name2=CLANG_CUDA,
value_version2=">12",
)
122 changes: 122 additions & 0 deletions tests/test_filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,125 @@ def test_non_valid_ROCm_images_Ubuntu2004_based_d4(self):
error_msg,
f"{test_row}",
)

def test_valid_cuda_versions_for_ubuntu_d3(self):
for CUDA_version in [10.2, 11.4, 15]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "22.04")),
}
),
)
)

self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "22.04")),
}
),
)
)
for CUDA_version in [10.2, 11.4, 15]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "20.04")),
}
),
)
)

self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "20.04")),
}
),
)
)
for CUDA_version in [2, 6, 10.1, 10.2, 11.4, 15]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "18.04")),
}
),
)
)

self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "18.04")),
}
),
)
)

def test_not_valid_cuda_versions_for_ubuntu_d3(self):
for CUDA_version in [1, 6, 10.1]:
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "20.04")),
}
),
reason_msg,
),
f"CUDA {CUDA_version} is not available in Ubuntu 20.04",
)
self.assertEqual(
reason_msg.getvalue(),
f"CUDA {CUDA_version} is not available in Ubuntu 20.04",
)
for gcc_version in [1, 6, 10.1]:
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_CUDA_ENABLE: ppv(
(ALPAKA_ACC_GPU_CUDA_ENABLE, CUDA_version)
),
UBUNTU: ppv((UBUNTU, "22.04")),
}
),
reason_msg,
),
f"CUDA {CUDA_version} is not available in Ubuntu 22.04",
)
self.assertEqual(
reason_msg.getvalue(),
f"CUDA {CUDA_version} is not available in Ubuntu 22.04",
)
Loading

0 comments on commit 164477f

Please sign in to comment.