diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-19 22:18:33 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-19 22:18:33 +0000 |
| commit | 3af5dcf34d705cc52c1ffe5b85c2a90b5104e4c9 (patch) | |
| tree | 8ad5b61b2818baf1af80c0a725622cda2c3fa1b8 /examples/gpu/cuda_info.zc | |
| parent | 959a27fd763e2e960ef31adf891118a261bad1c7 (diff) | |
Improve 'std/cuda.zc' and 'std/vec.zc' + iteration...
Diffstat (limited to 'examples/gpu/cuda_info.zc')
| -rw-r--r-- | examples/gpu/cuda_info.zc | 33 |
1 files changed, 33 insertions, 0 deletions
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}"; + } +} |
