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

Draft:Adding new filter rule (all ROCm images are Ubuntu 20.04 based) #51

Merged
merged 1 commit into from
Sep 17, 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
9 changes: 9 additions & 0 deletions src/bashi/filter_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ def compiler_filter(
):
reason(output, "hipcc does not support the CUDA backend.")
return False
# Rule: c19
# all ROCm images are Ubuntu 20.04 based or newer
# related to rule d3
if UBUNTU in row and row[UBUNTU].version < pkv.parse("20.04"):
reason(
output,
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
)
return False

if compiler in row and row[compiler].name == ICPX:
# Rule: c12
Expand Down
16 changes: 14 additions & 2 deletions 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, CLANG_CUDA, CMAKE
from bashi.globals import * # pylint: disable=wildcard-import,unused-wildcard-import
from bashi.utils import reason


Expand Down Expand Up @@ -103,5 +103,17 @@ def software_dependency_filter(
f"{row[CMAKE].version}",
)
return False

# Rule: d3
# all ROCm images are Ubuntu 20.04 based or newer
# related to rule c19

if UBUNTU in row and row[UBUNTU].version < pkv.parse("20.04"):
if ALPAKA_ACC_GPU_HIP_ENABLE in row and row[ALPAKA_ACC_GPU_HIP_ENABLE].version != OFF_VER:
reason(
output,
"ROCm and also the hipcc compiler "
"is not available on Ubuntu "
"older than 20.04",
)
return False
return True
35 changes: 35 additions & 0 deletions src/bashi/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def get_expected_bashi_parameter_value_pairs(
_remove_unsupported_cmake_versions_for_clangcuda(
param_val_pair_list, removed_param_val_pair_list
)
_remove_all_rocm_images_older_than_ubuntu2004_based(
param_val_pair_list, removed_param_val_pair_list
)
return (param_val_pair_list, removed_param_val_pair_list)


Expand Down Expand Up @@ -792,3 +795,35 @@ def _remove_unsupported_cmake_versions_for_clangcuda(
value_name2=CMAKE,
value_version2=">3.18",
)


def _remove_all_rocm_images_older_than_ubuntu2004_based(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
"""Remove all pairs where Ubuntu is older than 20.04 and the HIP backend is enabled or the host
or device compiler is HIPCC.
Args:
parameter_value_pairs (List[ParameterValuePair]): List of parameter-value pairs.
"""
remove_parameter_value_pairs(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=UBUNTU,
value_name1=UBUNTU,
value_version1=">=20.04",
parameter2=ALPAKA_ACC_GPU_HIP_ENABLE,
value_name2=ALPAKA_ACC_GPU_HIP_ENABLE,
value_version2=ON,
)
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=HIPCC,
value_version2=ANY_VERSION,
)
113 changes: 113 additions & 0 deletions tests/test_filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,116 @@ def test_not_valid_cmake_versions_for_clangcuda_d2(self):
reason_msg.getvalue(),
f"device compiler CLANG_CUDA is not available in CMAKE {cmake_version}",
)

def test_valid_ROCm_images_Ubuntu2004_based_d4(self):
for UBUNTU_version in ["20.04", "22.04", "21.04"]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_HIP_ENABLE: ppv((ALPAKA_ACC_GPU_HIP_ENABLE, ON)),
UBUNTU: ppv((UBUNTU, UBUNTU_version)),
}
),
)
)

for UBUNTU_version in ["16.04", "18.04", "19.04", "20.04", "22.04", "21.04"]:
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_HIP_ENABLE: ppv((ALPAKA_ACC_GPU_HIP_ENABLE, OFF)),
UBUNTU: ppv((UBUNTU, UBUNTU_version)),
}
),
),
)
self.assertTrue(
software_dependency_filter_typechecked(
OD(
{
HOST_COMPILER: ppv((HIPCC, 1)),
DEVICE_COMPILER: ppv((HIPCC, 1)),
ALPAKA_ACC_GPU_HIP_ENABLE: ppv((ALPAKA_ACC_GPU_HIP_ENABLE, OFF)),
UBUNTU: ppv((UBUNTU, "18.04")),
}
),
),
)

SimeonEhrig marked this conversation as resolved.
Show resolved Hide resolved
def test_non_valid_ROCm_images_Ubuntu2004_based_d4(self):
for UBUNTU_version in ["16.04", "18.04", "19.04"]:
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(
OD(
{
ALPAKA_ACC_GPU_HIP_ENABLE: ppv((ALPAKA_ACC_GPU_HIP_ENABLE, ON)),
UBUNTU: ppv((UBUNTU, UBUNTU_version)),
}
),
reason_msg,
),
f"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
)
self.assertEqual(
reason_msg.getvalue(),
f"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
)

for host_name, device_name, hip_backend, ubuntu_version, error_msg in [
(
HIPCC,
HIPCC,
ON,
"18.04",
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
),
(
HIPCC,
GCC,
ON,
"18.04",
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
),
(
CLANG,
HIPCC,
ON,
"18.04",
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
),
(
GCC,
HIPCC,
ON,
"18.04",
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
),
(
HIPCC,
CLANG,
ON,
"18.04",
"ROCm and also the hipcc compiler is not available on Ubuntu older than 20.04",
),
]:
test_row = OD(
{
HOST_COMPILER: ppv((host_name, 1)),
DEVICE_COMPILER: ppv((device_name, 1)),
ALPAKA_ACC_GPU_HIP_ENABLE: ppv((ALPAKA_ACC_GPU_HIP_ENABLE, hip_backend)),
UBUNTU: ppv((UBUNTU, ubuntu_version)),
},
)
reason_msg = io.StringIO()
self.assertFalse(
software_dependency_filter_typechecked(test_row, reason_msg),
f"{test_row}",
)
self.assertEqual(
reason_msg.getvalue(),
error_msg,
f"{test_row}",
)
Loading
Loading