gusucode.com > vision工具箱matlab源码程序 > vision/+vision/+internal/requiresCUDAComputeCapability30.m
function requiresCUDAComputeCapability30(filename) % requiresCUDAComputeCapability30 % requiresCUDAComputeCapability30 will error if the currently selected % GPU device cannot be used with the Convolutional Neural Network % feature, which requires an NVIDIA GPU with compute capability 3.0 % Copyright 2016 The MathWorks, Inc. if(canUsePCT() && parallel.gpu.GPUDevice.isAvailable()) gpuInfo = gpuDevice(); meetsRequirements = iComputeCapabilityIsGreaterThanOrEqualToThree(gpuInfo); else meetsRequirements = false; end if ~meetsRequirements error(message('vision:rcnn:requiresComputeCapability30',filename)) end % PASCAL cards not supported. This can be removed once the cuDNN bug % is fixed. gpuInfo = gpuDevice(); if str2double(gpuInfo.ComputeCapability) >= 6.0 error(message('nnet_cnn:internal:cnngpu:PascalCardsNotSupported')); end end function tf = iComputeCapabilityIsGreaterThanOrEqualToThree(gpuInfo) tf = str2double(gpuInfo.ComputeCapability) >= 3.0; end function ok = canUsePCT() %canUsePCT Check that Parallel Computing Toolbox is installed and licensed % Checking for installation is expensive, so only do it once persistent pctInstalled; if isempty(pctInstalled) pctInstalled = exist('gpuArray', 'file') == 2; end % Check the license every time as it may have changed pctLicensed = license('test', 'Distrib_Computing_Toolbox'); % Now see if everything is OK with the hardware ok = pctInstalled && pctLicensed; end