pip install cuda-python★The umbrella metapackage — pulls incuda-bindings+cuda-core. Needs an NVIDIA GPU + driver; the CUDA toolkit libs come via pip wheels.pip install cuda-core cuda-bindings # install parts independentlyEach subpackage is versioned separately now, so you can pin just what you use.from cuda.core.experimental import Device, Program, LaunchConfig, launch from cuda.bindings import driver, runtime, nvrtc★Two import roots: high-levelcuda.core.experimental, low-levelcuda.bindings.*.# old: from cuda import cuda, cudart, nvrtc (pre-12.x layout)migrationThe flatfrom cuda import cudalayout was replaced bycuda.bindings.driver/.runtime/.nvrtc. Update old code.
dev = Device(0) dev.set_current()★Devicewraps a GPU + its context.set_current()makes it active for this thread.dev.name · dev.compute_capability · dev.propertiesQuery the device.Device().device_id; iterate all GPUs withrange(Device.num_devices)-style helpers.stream = dev.create_stream()★AStreamis the ordered queue you submit compiles, copies, and kernel launches to (card 9).arch = "".join(str(i) for i in dev.compute_capability) # e.g. "90"You'll pass the arch (sm_90) to the compiler in card 3.