Skip to content

Commit

Permalink
Fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriiPerets committed Sep 18, 2024
1 parent 98a8b0f commit 93ae536
Show file tree
Hide file tree
Showing 6 changed files with 515 additions and 11 deletions.
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
26 changes: 15 additions & 11 deletions src/bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +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,
ALPAKA_ACC_GPU_CUDA_ENABLE,
OFF_VER,
NVCC,
)
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

Expand Down Expand Up @@ -116,6 +106,20 @@ def software_dependency_filter(
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

# 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"):
Expand Down
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
)
_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 @@ -795,6 +798,38 @@ def _remove_unsupported_cmake_versions_for_clangcuda(
)


def _remove_all_rocm_images_older_than_ubuntu2004_based(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
"""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,
)


def _remove_unsupported_cuda_versions_for_ubuntu(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
Expand Down
113 changes: 113 additions & 0 deletions tests/test_filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,119 @@ def test_not_valid_cmake_versions_for_clangcuda_d2(self):
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")),
}
),
),
)

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}",
)

def test_valid_cuda_versions_for_ubuntu_d3(self):
for CUDA_version in [10.2, 11.4, 15]:
self.assertTrue(
Expand Down
Loading

0 comments on commit 93ae536

Please sign in to comment.