From 3af5dcf34d705cc52c1ffe5b85c2a90b5104e4c9 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Mon, 19 Jan 2026 22:18:33 +0000 Subject: Improve 'std/cuda.zc' and 'std/vec.zc' + iteration... --- examples/gpu/cuda_info.zc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 examples/gpu/cuda_info.zc (limited to 'examples/gpu') diff --git a/examples/gpu/cuda_info.zc b/examples/gpu/cuda_info.zc new file mode 100644 index 0000000..7e832d1 --- /dev/null +++ b/examples/gpu/cuda_info.zc @@ -0,0 +1,33 @@ + +import "std/cuda.zc" +import "std/string.zc" + +fn main() { + var count = cuda_device_count(); + "---------------------------"; + "CUDA Device Count: {count}"; + "---------------------------"; + + if (count > 0) { + var props = cuda_device_properties(0); + + "Device Name: {props.name.vec.data}"; + "Total Global Mem: {props.total_global_mem}"; + "SM Count: {props.multi_processor_count}"; + "Compute Capability: {props.major}.{props.minor}"; + "Max Threads per Block: {props.max_threads_per_block}"; + "Warp Size: {props.warp_size}"; + + props.name.free(); + + var driver = cuda_driver_version(); + var runtime = cuda_runtime_version(); + + "Driver Version: {driver}"; + "Runtime Version: {runtime}"; + + var mem = cuda_mem_info(); + "Free Mem: {mem.free}"; + "Total Mem: {mem.total}"; + } +} -- cgit v1.2.3