Skip to content

Commit

Permalink
Draft update
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriiPerets committed Oct 16, 2024
1 parent 0cddfef commit 89327ba
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 54 deletions.
22 changes: 17 additions & 5 deletions src/bashi/filter_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
NVCC_CLANG_MAX_VERSION,
CLANG_CUDA_MAX_CUDA_VERSION,
NVCC_CXX_SUPPORT,
NVCC_GCC_CXX_SUPPORT,
)

from bashi.utils import reason
Expand Down Expand Up @@ -148,6 +149,17 @@ def backend_filter(
return False
break

if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version <= NVCC_GCC_CXX_SUPPORT[0].nvcc:
# check the maximum supported nvcc version for the given cxx version
for nvcc_gcc_comb in NVCC_GCC_CXX_SUPPORT:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version < nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version >= nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
break

if HOST_COMPILER in row and row[HOST_COMPILER].name == CLANG:
# Rule: b11
# related to rule c8
Expand Down Expand Up @@ -214,18 +226,18 @@ def backend_filter(
# Rule: b18
# related to rule d5
if CXX_STANDARD in row:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version <= NVCC_CXX_SUPPORT[0].nvcc_version:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version <= NVCC_CXX_SUPPORT[0].nvcc:
for cuda_cxx_comb in NVCC_CXX_SUPPORT:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version >= cuda_cxx_comb.nvcc_version:
if row[CXX_STANDARD].version >= cuda_cxx_comb.cxx_version:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version >= cuda_cxx_comb.nvcc:
if row[CXX_STANDARD].version >= cuda_cxx_comb.cxx:
reason(
output,
f"cuda {row[ALPAKA_ACC_GPU_CUDA_ENABLE].version} "
f"does not support cxx {row[CXX_STANDARD].version}",
)
return False
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version >= cuda_cxx_comb.nvcc_version:
if row[CXX_STANDARD].version >= cuda_cxx_comb.cxx_version:
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version >= cuda_cxx_comb.nvcc:
if row[CXX_STANDARD].version >= cuda_cxx_comb.cxx:
reason(
output,
f"cuda {row[ALPAKA_ACC_GPU_CUDA_ENABLE].version} "
Expand Down
17 changes: 16 additions & 1 deletion src/bashi/filter_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ def compiler_filter(
return False
break

# Rule: c21
# related to rule:
# remove all unsupported nvcc gcc version combinations with cxx
"""
if row[DEVICE_COMPILER].version <= NVCC_GCC_CXX_SUPPORT[0].nvcc:
# check the maximum supported nvcc version for the given cxx version
for nvcc_gcc_comb in NVCC_GCC_CXX_SUPPORT:
if row[DEVICE_COMPILER].version < nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
if row[DEVICE_COMPILER].version >= nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
break
"""
if HOST_COMPILER in row and row[HOST_COMPILER].name == CLANG:
# Rule: c7
# related to rule b11
Expand Down Expand Up @@ -247,7 +262,7 @@ def compiler_filter(
ALPAKA_ACC_GPU_CUDA_ENABLE in row
and row[ALPAKA_ACC_GPU_CUDA_ENABLE].version != OFF_VER
):
# Rule: c16
# Rule: c20
# related to rule b17
# if a clang-cuda version is newer than the latest known clang-cuda version,
# we needs to assume that it supports every CUDA SDK version
Expand Down
46 changes: 36 additions & 10 deletions src/bashi/filter_software_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
get_oldest_supporting_clang_version_for_cuda,
GCC_CXX_SUPPORT,
NVCC_CXX_SUPPORT,
NVCC_GCC_CXX_SUPPORT,
CLANG_CXX_SUPPORT,
)


Expand Down Expand Up @@ -164,23 +166,35 @@ def software_dependency_filter(
# Rule: d5
# related to rule b18
# remove all unsupported gcc cxx and nvcc cxx version combinations
if HOST_COMPILER in row and row[HOST_COMPILER].name == CLANG:
if CXX_STANDARD in row:
if row[HOST_COMPILER].version <= CLANG_CXX_SUPPORT[0].clang:
# check the maximum supported gcc version for the given cxx version
for clang_cxx_comb in CLANG_CXX_SUPPORT:
if row[HOST_COMPILER].version < clang_cxx_comb.clang:
if row[CXX_STANDARD].version >= clang_cxx_comb.cxx:
return False
if row[HOST_COMPILER].version >= clang_cxx_comb.clang:
if row[CXX_STANDARD].version >= clang_cxx_comb.cxx:
return False
break

if HOST_COMPILER in row and row[HOST_COMPILER].name == GCC:
if CXX_STANDARD in row:
if row[HOST_COMPILER].version <= GCC_CXX_SUPPORT[0].gcc_version:
if row[HOST_COMPILER].version <= GCC_CXX_SUPPORT[0].gcc:
# check the maximum supported gcc version for the given cxx version
for gcc_cxx_comb in GCC_CXX_SUPPORT:
if row[HOST_COMPILER].version < gcc_cxx_comb.gcc_version:
if row[CXX_STANDARD].version >= gcc_cxx_comb.cxx_version:
if row[HOST_COMPILER].version < gcc_cxx_comb.gcc:
if row[CXX_STANDARD].version >= gcc_cxx_comb.cxx:
reason(
output,
"host compiler"
f" gcc {row[HOST_COMPILER].version} "
f"does not support cxx {row[CXX_STANDARD].version}",
)
return False
if row[HOST_COMPILER].version >= gcc_cxx_comb.gcc_version:
if row[CXX_STANDARD].version >= gcc_cxx_comb.cxx_version:
if row[HOST_COMPILER].version >= gcc_cxx_comb.gcc:
if row[CXX_STANDARD].version >= gcc_cxx_comb.cxx:
reason(
output,
"host compiler"
Expand All @@ -192,20 +206,20 @@ def software_dependency_filter(

if DEVICE_COMPILER in row and row[DEVICE_COMPILER].name == NVCC:
if CXX_STANDARD in row:
if row[DEVICE_COMPILER].version <= NVCC_CXX_SUPPORT[0].nvcc_version:
if row[DEVICE_COMPILER].version <= NVCC_CXX_SUPPORT[0].nvcc:
# check the maximum supported nvcc version for the given cxx version
for nvcc_cxx_comb in NVCC_CXX_SUPPORT:
if row[DEVICE_COMPILER].version < nvcc_cxx_comb.nvcc_version:
if row[CXX_STANDARD].version >= nvcc_cxx_comb.cxx_version:
if row[DEVICE_COMPILER].version < nvcc_cxx_comb.nvcc:
if row[CXX_STANDARD].version >= nvcc_cxx_comb.cxx:
reason(
output,
"device compiler"
f" nvcc {row[DEVICE_COMPILER].version} "
f"does not support cxx {row[CXX_STANDARD].version}",
)
return False
if row[DEVICE_COMPILER].version >= nvcc_cxx_comb.nvcc_version:
if row[CXX_STANDARD].version >= nvcc_cxx_comb.cxx_version:
if row[DEVICE_COMPILER].version >= nvcc_cxx_comb.nvcc:
if row[CXX_STANDARD].version >= nvcc_cxx_comb.cxx:
reason(
output,
"device compiler"
Expand All @@ -215,6 +229,18 @@ def software_dependency_filter(
return False
break

if HOST_COMPILER in row and row[HOST_COMPILER].name == GCC:
if row[DEVICE_COMPILER].version <= NVCC_GCC_CXX_SUPPORT[0].nvcc:
# check the maximum supported nvcc version for the given cxx version
for nvcc_gcc_comb in NVCC_GCC_CXX_SUPPORT:
if row[DEVICE_COMPILER].version < nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
if row[DEVICE_COMPILER].version >= nvcc_gcc_comb.nvcc:
if row[HOST_COMPILER].version >= nvcc_gcc_comb.gcc:
return False
break

"""
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
if compiler_type in row and row[compiler_type].name == GCC:
Expand Down
36 changes: 2 additions & 34 deletions src/bashi/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
CLANG_CUDA_MAX_CUDA_VERSION,
NvccHostSupport,
ClangCudaSDKSupport,
GCC_CXX_SUPPORT,
GccCxxSupport,
)


Expand Down Expand Up @@ -967,37 +969,3 @@ def _remove_unsupported_cxx_versions_for_nvcc(
value_min_version2=20,
value_min_version2_inclusive=True,
)


"""
def _remove_unsupported_cxx_versions_for_gcc(
parameter_value_pairs: List[ParameterValuePair],
removed_parameter_value_pairs: List[ParameterValuePair],
):
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
remove_parameter_value_pairs_ranges(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=compiler_type,
value_name1=GCC,
value_min_version1=10,
value_max_version1=14,
value_max_version1_inclusive=False,
parameter2=CXX_STANDARD,
value_name2=CXX_STANDARD,
value_min_version2=20,
value_min_version2_inclusive=True,
)
for compiler_type in (HOST_COMPILER, DEVICE_COMPILER):
remove_parameter_value_pairs_ranges(
parameter_value_pairs,
removed_parameter_value_pairs,
parameter1=compiler_type,
value_name1=GCC,
value_min_version1=14,
parameter2=CXX_STANDARD,
value_name2=CXX_STANDARD,
value_min_version2=24,
value_min_version2_inclusive=True,
)
"""
44 changes: 40 additions & 4 deletions src/bashi/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class GccCxxSupport(VersionSupportBase):

def __init__(self, gcc_version: str, cxx_version: str):
VersionSupportBase.__init__(self, gcc_version, cxx_version)
self.gcc_version: packaging.version.Version = self.version1
self.cxx_version: packaging.version.Version = self.version2
self.gcc: packaging.version.Version = self.version1
self.cxx: packaging.version.Version = self.version2

def __str__(self) -> str:
return f"GCC {str(self.gcc_version)} + CXX {self.cxx_version}"
Expand All @@ -91,13 +91,33 @@ class NvccCxxSupport(VersionSupportBase):

def __init__(self, nvcc_version: str, cxx_version: str):
VersionSupportBase.__init__(self, nvcc_version, cxx_version)
self.nvcc_version: packaging.version.Version = self.version1
self.cxx_version: packaging.version.Version = self.version2
self.nvcc: packaging.version.Version = self.version1
self.cxx: packaging.version.Version = self.version2

def __str__(self) -> str:
return f"NVCC {str(self.nvcc_version)} + CXX {self.cxx_version}"


class NvccGccCxxSupport(VersionSupportBase):
def __init__(self, nvcc_version: str, gcc_version: str):
VersionSupportBase.__init__(self, nvcc_version, gcc_version)
self.nvcc: packaging.version.Version = self.version1
self.gcc: packaging.version.Version = self.version2

def __str__(self) -> str:
return f"NVCC {str(self.gcc_version)} + GCC {self.cxx_version}"


class ClangCxxSupport(VersionSupportBase):
def __init__(self, clang_version: str, cxx_version: str):
VersionSupportBase.__init__(self, clang_version, cxx_version)
self.clang: packaging.version.Version = self.version1
self.cxx: packaging.version.Version = self.version2

def __str__(self) -> str:
return f"Clang {str(self.clang_version)} + cxx {self.cxx_version}"


VERSIONS: Dict[str, List[Union[str, int, float]]] = {
GCC: [6, 7, 8, 9, 10, 11, 12, 13],
CLANG: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
Expand Down Expand Up @@ -165,13 +185,29 @@ def __str__(self) -> str:
]
GCC_CXX_SUPPORT.sort(reverse=True)


# define the maximum supported cxx version for a specific nvcc version
NVCC_CXX_SUPPORT: List[GccCxxSupport] = [
NvccCxxSupport("11.0", "17"), # NVCC versions older than 11.0 does not support C++ 17
NvccCxxSupport("12.0", "20"), # NVCC versions older than 12.0 does not support C++ 20
]
NVCC_CXX_SUPPORT.sort(reverse=True)


# define the maximum supported cxx version for a specific nvcc gcc combination
NVCC_GCC_CXX_SUPPORT: List[NvccGccCxxSupport] = [
NvccGccCxxSupport("10.1", "8"),
NvccGccCxxSupport("11.1", "10"),
]
NVCC_CXX_SUPPORT.sort(reverse=True)


CLANG_CXX_SUPPORT: List[ClangCxxSupport] = [
ClangCxxSupport("9", "17"),
ClangCxxSupport("14", "20"),
]
CLANG_CXX_SUPPORT.sort(reverse=True)

# define the maximum supported clang version for a specific nvcc version
# the latest supported nvcc version must be added, even if the supported clang version does not
# increase
Expand Down

0 comments on commit 89327ba

Please sign in to comment.