| 185 | |
| 186 | |
| 187 | def check_cuda_versions(): |
| 188 | if torch.cuda.is_available(): |
| 189 | try: |
| 190 | cuda_runtime_version = torch.version.cuda |
| 191 | print(f"CUDA Runtime : {cuda_runtime_version}") |
| 192 | import subprocess |
| 193 | |
| 194 | nvcc_output = subprocess.check_output(["nvcc", "--version"]).decode("utf-8") |
| 195 | cuda_compiler_version = next((line for line in nvcc_output.splitlines() if "release" in line), None) |
| 196 | if cuda_compiler_version: |
| 197 | print(f"CUDA Compiler : {cuda_compiler_version.strip()}") |
| 198 | else: |
| 199 | print("Could not determine CUDA compiler version.") |
| 200 | except FileNotFoundError as e: |
| 201 | print(f"CUDA compiler : Not found: {e}") |
| 202 | except Exception as e: |
| 203 | print(f"An error occurred while checking CUDA versions: {e}") |
| 204 | else: |
| 205 | print("CUDA is not available.") |
| 206 | |
| 207 | |
| 208 | def _get_cpu_memory(): |