Faster DP_fiber with GPU processing... Run test\gpu_cpu_comparison.m to see difference on your setup
This commit is contained in:
20
Classes/02_optical/dp_fiber_lib/canUseGPU.m
Normal file
20
Classes/02_optical/dp_fiber_lib/canUseGPU.m
Normal file
@@ -0,0 +1,20 @@
|
||||
function canUse = canUseGPU()
|
||||
%CANUSEGPU Check if a compatible GPU is available for parallel computing
|
||||
% Returns true if MATLAB Parallel Computing Toolbox is available and
|
||||
% a CUDA-capable GPU is detected.
|
||||
|
||||
canUse = false;
|
||||
|
||||
% Check if Parallel Computing Toolbox is installed
|
||||
if ~license('test', 'Distrib_Computing_Toolbox')
|
||||
return;
|
||||
end
|
||||
|
||||
% Check for GPU device
|
||||
try
|
||||
gpu = gpuDevice();
|
||||
canUse = gpu.DeviceSupported;
|
||||
catch
|
||||
canUse = false;
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user