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(Ubuntu 20.04 does not support CUDA <10.2) #50

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YuriiPerets
Copy link
Contributor

@YuriiPerets YuriiPerets commented Sep 9, 2024

fix: #32

@SimeonEhrig
Copy link
Member

I did a mistake in the issue description. CUDA 10.2 and older is not available in Ubuntu 20.04. You can check for < pkv.parse("11.0).

@@ -143,6 +143,12 @@ def backend_filter(
return False
break

# Rule: b18
# related to rule
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version < pkv.parse("10.2"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version < pkv.parse("10.2"):
if row[ALPAKA_ACC_GPU_CUDA_ENABLE].version < pkv.parse("11.0"):

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:
Copy link
Member

@SimeonEhrig SimeonEhrig Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, that you check also for Clang-CUDA :-) Thanks correct and didn't thought about it.

Unfortunately, there is no guaranty that CLANG_CUDA_MAX_CUDA_VERSION keeps his ordering. Therefore you need to replace the direct access with a search function. Otherwise your code could silently break, if somebody modifies the CLANG_CUDA_MAX_CUDA_VERSION list. You need to implement the following function:

def get_max_supported_clang_cuda_ver(cuda_ver : str) -> str:
  """ returns the latest supported clang-cuda version for a given cuda version"
  # implement search algorithm 
  # don't expect specific ordering of the list CLANG_CUDA_MAX_CUDA_VERSION 
  # implement also tests 

Implement the function in the version.py.

By the way, an entry of CLANG_CUDA_MAX_CUDA_VERSION stores only string. Therefore you need to parse the version. At the moment, you compare version objects with strings, which is always wrong.
The versions in ClangCudaSDKSupport are already parsed and stored as packaging.version.Version.

class ClangCudaSDKSupport(VersionSupportBase):
"""Contains a nvcc version and host compiler version. Does automatically parse the input strings
to package.version.Version.
Provides comparision operators for sorting.
"""
def __init__(self, clang_cuda_version: str, cuda_version: str):
VersionSupportBase.__init__(self, clang_cuda_version, cuda_version)
self.clang_cuda = self.version1
self.cuda = self.version2
def __str__(self) -> str:
return f"Clang-CUDA {str(self.clang_cuda)} + CUDA SDK {self.cuda}"

Copy link
Member

@SimeonEhrig SimeonEhrig Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that the interface takes a string and the first step is parsing it to a version object. Makes the function call easier:

# expected string as argument (preferred version)
get_max_supported_clang_cuda_ver("11.2")

# expected version object as argument
get_max_supported_clang_cuda_ver(pkv.parse("11.2")
# implementation for the preferred version
def get_max_supported_clang_cuda_ver(cuda_ver : str) -> str:
  """ returns the latest supported clang-cuda version for a given cuda version"
  parsed_cuda_ver: pkv.Version = pkv.parse(cuda_ver)
  # implement search algorithm 
  # don't expect specific ordering of the list CLANG_CUDA_MAX_CUDA_VERSION 
  # implement also tests 

@@ -792,3 +793,31 @@ def _remove_unsupported_cmake_versions_for_clangcuda(
value_name2=CMAKE,
value_version2=">3.18",
)


def _remove_unsupported_cuda_versions_for_ubuntu(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function needs also to remove unsupported device compiler nvcc + ubuntu 18.04 combinations and clang-cuda + ubuntu 18.04. I saw that the example.py misses the following combinations:

ParameterValuePair(first=ParameterValueSingle(parameter='device_compiler', parameterValue=ParameterValue(name='nvcc', version=<Version('10.0')>)), second=ParameterValueSingle(parameter='ubuntu', parameterValue=ParameterValue(name='ubuntu', version=<Version('20.4')>))) is missing in combination list
ParameterValuePair(first=ParameterValueSingle(parameter='device_compiler', parameterValue=ParameterValue(name='nvcc', version=<Version('10.1')>)), second=ParameterValueSingle(parameter='ubuntu', parameterValue=ParameterValue(name='ubuntu', version=<Version('20.4')>))) is missing in combination list

But we cannot install CUDA 10.0 and 10.1 on Ubuntu 20.04

@SimeonEhrig
Copy link
Member

I strongly recommend to fix the function _remove_unsupported_cuda_versions_for_ubuntu() first. You can do it with test cases and it is much easier than writing the filter rules. One time, if the function is working, running the example.py gives you also the correct hints, what is not correctly filtered and which filter rules needs to be fixed.

For example the jobs.yml which is generated by the example.py still the combination Ubuntu 18.04 + CUDA 10.1 if the host compiler is Clang-CUDA. We do not expect the combination. But _remove_unsupported_cuda_versions_for_ubuntu() is not correctly working and therefore the example.py will not tell you, that this unexpected combination was generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add filter rule: Ubuntu 20.04 does not support CUDA <=10.2
2 participants