diff options
Diffstat (limited to 'examples')
| -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}"; + } +} |
