(run_lambda)
| 182 | |
| 183 | |
| 184 | def get_gpu_info(run_lambda): |
| 185 | if get_platform() == "darwin" or ( |
| 186 | TORCH_AVAILABLE |
| 187 | and hasattr(torch.version, "hip") |
| 188 | and torch.version.hip is not None |
| 189 | ): |
| 190 | if TORCH_AVAILABLE and torch.cuda.is_available(): |
| 191 | if torch.version.hip is not None: |
| 192 | prop = torch.cuda.get_device_properties(0) |
| 193 | if hasattr(prop, "gcnArchName"): |
| 194 | gcnArch = " ({})".format(prop.gcnArchName) |
| 195 | else: |
| 196 | gcnArch = "NoGCNArchNameOnOldPyTorch" |
| 197 | else: |
| 198 | gcnArch = "" |
| 199 | return torch.cuda.get_device_name(None) + gcnArch |
| 200 | return None |
| 201 | smi = get_nvidia_smi() |
| 202 | uuid_regex = re.compile(r" \(UUID: .+?\)") |
| 203 | rc, out, _ = run_lambda(smi + " -L") |
| 204 | if rc != 0: |
| 205 | return None |
| 206 | # Anonymize GPUs by removing their UUID |
| 207 | return re.sub(uuid_regex, "", out) |
| 208 | |
| 209 | |
| 210 | def get_running_cuda_version(run_lambda): |
no test coverage detected