load dataset.mat%The dataset has 2 variables, X and Y. In order to use them the transpose is required
target = Y.';inputs = X.'; net1 = feedforwardnet(10);net1.trainFcn = 'trainscg';Xgpu = gpuArray(inputs);Tgpu = gpuArray(target);net2 = configure(net1,inputs,target);net2 = train(net1,Xgpu,Tgpu,'useGPU','only','showResources','yes');
My code in Matlab is the one above. The problem comes with the last line as the GPU can't handle all the operation. I've seen in other questions that the batchSize can be altered so the GPU works better, however, I cannot find a way to do so with a shallow neural network (as I'm required to use train instead of trainNetwork).
The complete error trace that appears in the matlab command window is the following:
Error in nntraining.setup>setupPerWorker (line 126) [net,X,Xi,Ai,T,EW,Q,TS,err] = nntraining.config(net,X,Xi,Ai,T,EW,configNetEnable);Error in nntraining.setup (line 77) [net,data,tr,err] = setupPerWorker(net,trainFcn,X,Xi,Ai,T,EW,enableConfigure);Error in network/train (line 335)[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,enableConfigure,isComposite);Error in ejemplo2 (line 16)
gpuDevice() shows the following:
>> gpuDevice(1)ans = CUDADevice with properties: Name: 'Quadro P5000' Index: 1 ComputeCapability: '6.1' SupportsDouble: 1 DriverVersion: 10.2000 ToolkitVersion: 10 MaxThreadsPerBlock: 1024 MaxShmemPerBlock: 49152 MaxThreadBlockSize: [1024 1024 64] MaxGridSize: [2.1475e+09 65535 65535] SIMDWidth: 32 TotalMemory: 1.7180e+10 AvailableMemory: 1.4279e+10 MultiprocessorCount: 20 ClockRateKHz: 1733500 ComputeMode: 'Default' GPUOverlapsTransfers: 1 KernelExecutionTimeout: 1 CanMapHostMemory: 1 DeviceSupported: 1 DeviceSelected: 1
I wold like to know how can i fix this. I'm traying to see the diferences between working only on CPU or using GPU
Best Answer