When using GPU with neural net, I run out of shared memory per block; is there a way to handle?

조회 수: 3 (최근 30일)
I want to train a neural net with several hundred images (75x75 pixels, or 5625 elements each). This works in native Matlab. When I try to train using 'useGPU' I get the error "The shared memory size for a kernel must be a positive integer, and must not exceed the device's limit on the amount of shared memory per block (49152 bytes)." coming from nnGPU.codeHints. The code:
net1=feedforwardnet(10);
xg=nndata2gpu(inputMatrix);
tg=nndata2gpu(targetMatrix);
net2=configure(net1,inputMatrix,targetMatrix);
net2=train(net2,xg,tg);
Is there a way to tell the neural net training system to process the training in smaller chunks? Or some other smarter way to do this?

답변 (1개)

Mark Hudson Beale
Mark Hudson Beale 2013년 6월 19일
편집: Mark Hudson Beale 2013년 7월 5일
I was able to reproduce your error. In MATLAB 13a the nndata2gpu array transformation is no longer required and if gpuArray is used (instead of nndata2gpu) the required amount of shared memory will be reduced.
d = gpuDevice
d.MaxShmemPerBlock
Using 13a and gpuArray I was able to train the following random problem on a mobile GPU with these specs: NVIDIA GeForce GT 650M 1024 MB in MATLAB 13a.
x = rand(5626,500);
t = rand(1,500);
X = gpuArray(x);
T = gpuArray(t);
net = feedforwardnet(10);
net = configure(net,x,t);
net.trainFcn = 'trainscg';
net = train(net,X,T);
I hope that helps!
  댓글 수: 1
William Engelke
William Engelke 2013년 6월 19일
With this code (which looks right, by the way), I get: Error using network/train (line 293) Number of samples (rows of gpuArrays) of data arguments do not match.
Error in GPUNET (line 11) net = train(net,X,T);
When I look at the sizes of the inputs, they look right, as follows:
>> size(X)
ans =
5626 500
>> size(T)
ans =
1 500
Maybe the problem is that I am using Matlab 2012b - (?) perhaps some bug was fixed in the newer release... anyway, I have decided to approach the problem a different way, such that it does not require so many rows.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by