pub fn is_cuda_available() -> bool
Expand description
Utility functions for GPU operations Check if CUDA is available on the system
Examples found in repository?
examples/gpu_acceleration.rs (line 50)
45fn demonstrate_gpu_detection() {
46 println!("๐ GPU DETECTION AND AVAILABILITY");
47 println!("{}", "-".repeat(40));
48
49 println!("CUDA Support:");
50 if is_cuda_available() {
51 println!(" โ
CUDA is available");
52 println!(" ๐ฏ NVIDIA GPU acceleration supported");
53 } else {
54 println!(" โ CUDA not available");
55 println!(" ๐ก Install CUDA toolkit for NVIDIA GPU support");
56 }
57
58 println!("\nOpenCL Support:");
59 if is_opencl_available() {
60 println!(" โ
OpenCL is available");
61 println!(" ๐ฏ Multi-vendor GPU acceleration supported");
62 } else {
63 println!(" โ OpenCL not available");
64 println!(" ๐ก Install OpenCL runtime for GPU support");
65 }
66
67 // Get optimal configuration
68 let optimal_config = get_optimal_gpu_config();
69 println!("\nOptimal Configuration:");
70 match optimal_config.backend {
71 GpuBackend::Cuda { device_id } => {
72 println!(" ๐ CUDA backend (device {device_id})");
73 }
74 GpuBackend::OpenCl {
75 platform_id,
76 device_id,
77 } => {
78 println!(" ๐ OpenCL backend (platform {platform_id}, device {device_id})");
79 }
80 GpuBackend::Cpu => {
81 println!(" ๐ป CPU fallback (no GPU available)");
82 }
83 }
84 println!(
85 " ๐งต Threads per block: {}",
86 optimal_config.threads_per_block
87 );
88 println!(
89 " ๐ข Double precision: {}",
90 optimal_config.enable_double_precision
91 );
92
93 println!();
94}