gpu slower than cpu for neural networks in matlab -
i have following code:
tic; h = rand(100, 1000); f = rand(1, 1000); net = newff(h, f, [30, 10], { 'tansig' 'tansig'}, 'traingdx', 'learngdm', 'mse'); net.trainparam.epochs = 400; net.performparam.regularization = 0.05; net.divideparam.trainratio = 1; net.divideparam.valratio = 0; net.divideparam.testratio = 0; net.trainparam.showwindow = 0; net.trainparam.showcommandline = 0; % net = train(net, h, f, 'usegpu', 'yes', 'showresources', 'yes'); % line 1 net = train(net, h, f, 'showresources', 'yes'); % line 2 toc;
with line 2 uncommented
computing resources: gpu device #1, geforce 800m elapsed time 5.084222 seconds.
and line 1 uncommented
computing resources: mex2 elapsed time 1.870803 seconds.
why gpu slower cpu? gpu properties:
cudadevice properties: name: 'geforce 800m' index: 1 computecapability: '2.1' supportsdouble: 1 driverversion: 6 toolkitversion: 5 maxthreadsperblock: 1024 maxshmemperblock: 49152 maxthreadblocksize: [1024 1024 64] maxgridsize: [65535 65535 65535] simdwidth: 32 totalmemory: 2.1475e+09 freememory: 1.9886e+09 multiprocessorcount: 1 clockratekhz: 1475000 computemode: 'default' gpuoverlapstransfers: 1 kernelexecutiontimeout: 1 canmaphostmemory: 1 devicesupported: 1 deviceselected: 1`
Comments
Post a Comment