()
| 164 | this._nvcc_version = None |
| 165 | |
| 166 | def check_cuda_versions(): |
| 167 | # Strip any additional information from the CUDA version |
| 168 | _cuda_version = base_cuda.__version__.split("rc")[0] |
| 169 | # Check that Python CUDA version exceeds NVCC version |
| 170 | this._nvcc_version = nvcc_version() |
| 171 | _cuda_list = _cuda_version.split('.') |
| 172 | _nvcc_list = this._nvcc_version.split('.') |
| 173 | for val_cuda, val_nvcc in zip(_cuda_list, _nvcc_list): |
| 174 | if int(val_cuda) < int(val_nvcc): |
| 175 | raise Exception(f"Python CUDA version of {_cuda_version} must be greater than or equal to NVCC version of {this._nvcc_version}") |
| 176 | |
| 177 | if len(_nvcc_list) > len(_cuda_list): |
| 178 | if len(_nvcc_list) != len(_cuda_list) + 1: |
| 179 | raise Exception(f"Malformatted NVCC version of {this._nvcc_version}") |
| 180 | if _nvcc_list[:-1] == _cuda_list and int(_nvcc_list[-1]) != 0: |
| 181 | raise Exception(f"Python CUDA version of {_cuda_version} must be greater than or equal to NVCC version of {this._nvcc_version}") |
| 182 | |
| 183 | def initialize_cuda_context(): |
| 184 | check_cuda_versions() |
no test coverage detected