Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/ampere/test_doctor.py # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / ampere / test_doctor.py` 49 lines · 2665 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 """SIMULATED filesystem preflight controls. No GPU driver calls.""" 4 import importlib.util 5 from pathlib import Path 6 import tempfile 7 8 spec = importlib.util.spec_from_file_location("ampere_doctor", Path(__file__).with_name("doctor.py")) 9 doctor = importlib.util.module_from_spec(spec) 10 spec.loader.exec_module(doctor) 11 12 def put(root, name, value): 13 path = root / name 14 path.parent.mkdir(parents=True, exist_ok=True) 15 path.write_text(value) 16 17 with tempfile.TemporaryDirectory(prefix="ampere-doctor-") as directory: 18 root = Path(directory) 19 def result(): 20 return doctor.inspect(root, machine="x86_64") 21 put(root, "proc/driver/nvidia/version", "NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 580.173.02\n") 22 for node in ("nvidia0", "nvidiactl", "nvidia-uvm"): 23 put(root, "dev/" + node, "") 24 gpu = "sys/bus/pci/devices/0000:01:00.0/" 25 put(root, gpu + "vendor", "0x10de") 26 put(root, gpu + "class", "0x030000") 27 put(root, "proc/driver/nvidia/gpus/0000:01:00.0/information", "Device Minor: 0\n") 28 for pci in doctor.CARDS: 29 put(root, gpu + "device", pci) 30 report = result() 31 assert report["preflight"] == "PASS", report 32 assert report["evidence"] == "SIMULATED" and report["device_execution"] == "NOT_RUN" 33 put(root, gpu + "device", "0x2e12") 34 assert result()["preflight"] == "FAIL", "negative control: GB10 must refuse" 35 put(root, gpu + "device", "0x2204") 36 put(root, "proc/driver/nvidia/version", "NVRM version: NVIDIA UNIX x86_64 Kernel Module 580.173.02\n") 37 assert result()["preflight"] == "FAIL", "negative control: closed module must refuse" 38 put(root, "proc/driver/nvidia/version", "NVRM version: NVIDIA UNIX Open Kernel Module 590.00.00\n") 39 assert result()["preflight"] == "FAIL", "negative control: mismatched driver must refuse" 40 put(root, "proc/driver/nvidia/version", "NVRM version: NVIDIA UNIX Open Kernel Module 580.173.02\n") 41 (root / "dev/nvidia-uvm").unlink() 42 assert result()["preflight"] == "FAIL", "negative control: missing UVM must refuse" 43 put(root, "dev/nvidia-uvm", "") 44 for key, value in (("vendor", "0x10de"), ("class", "0x030000"), ("device", "0x2486")): 45 put(root, "sys/bus/pci/devices/0000:02:00.0/" + key, value) 46 assert result()["preflight"] == "FAIL", "ambiguous GPU must refuse" 47 assert doctor.inspect(root, "0000:01:00.0", "x86_64")["preflight"] == "PASS" 48 assert doctor.inspect(root, "0000:01:00.0", "aarch64")["preflight"] == "FAIL" 49 print("AMPERE DOCTOR SIMULATED PASS (target IDs and refusal controls); DEVICE NOT_RUN")