Gather gpu device info. Returns: A list of test_log_pb2.GPUInfo messages.
()
| 160 | |
| 161 | |
| 162 | def gather_gpu_devices(): |
| 163 | """Gather gpu device info. |
| 164 | |
| 165 | Returns: |
| 166 | A list of test_log_pb2.GPUInfo messages. |
| 167 | """ |
| 168 | try: |
| 169 | # Prefer using /proc if possible, it provides the UUID. |
| 170 | dev_info = _gather_gpu_devices_proc() |
| 171 | if not dev_info: |
| 172 | raise ValueError("No devices found") |
| 173 | return dev_info |
| 174 | except (IOError, ValueError, errors.OpError): |
| 175 | pass |
| 176 | |
| 177 | try: |
| 178 | # Fall back on using libcudart |
| 179 | return _gather_gpu_devices_cudart() |
| 180 | except (OSError, ValueError, NotImplementedError, errors.OpError): |
| 181 | return [] |
nothing calls this directly
no test coverage detected