()
| 169 | |
| 170 | |
| 171 | def main() -> int: |
| 172 | import argparse |
| 173 | |
| 174 | parser = argparse.ArgumentParser( |
| 175 | description="Print CUDA system / NVML information via cuda.core.system" |
| 176 | ) |
| 177 | parser.add_argument( |
| 178 | "--no-topology", |
| 179 | action="store_true", |
| 180 | help="Skip cross-device topology/P2P queries", |
| 181 | ) |
| 182 | args = parser.parse_args() |
| 183 | |
| 184 | print_driver_info() |
| 185 | |
| 186 | num_devices = system.get_num_devices() |
| 187 | print_header(f"Devices detected: {num_devices}") |
| 188 | if num_devices == 0: |
| 189 | print("No CUDA-capable devices found.") |
| 190 | return 0 |
| 191 | if not CUDA_BINDINGS_NVML_IS_COMPATIBLE: |
| 192 | print( |
| 193 | "NVML is not compatible with the installed driver; skipping device detail." |
| 194 | ) |
| 195 | return 0 |
| 196 | |
| 197 | devices = [system.Device(index=i) for i in range(num_devices)] |
| 198 | for device in devices: |
| 199 | print_device_info(device) |
| 200 | |
| 201 | if not args.no_topology: |
| 202 | print_topology(devices) |
| 203 | |
| 204 | print("\nDone") |
| 205 | return 0 |
| 206 | |
| 207 | |
| 208 | if __name__ == "__main__": |
no test coverage detected