Borrar filtros
Borrar filtros

Custom Neural Network Sample Code Fails on GPU

4 visualizaciones (últimos 30 días)
Zachary David
Zachary David el 5 de Sept. de 2017
Editada: Zachary David el 12 de Sept. de 2017
Runs on CPU but fails on GPU.
The extra steps I added which are required to run efficiently on GPU
xg = nndata2gpu(X);
yg = nndata2gpu(Y);
and then either net = configure(net,X,T); OR using the [Xs,Xi,Ai,Ys,EWs,shift] = preparets(net,X,Y); method and sending all of the results to the gpu.
The problem appears to be when there are multiple input vectors of differing lengths. I have confirmed that this fails on simpler examples of similar type.
If there's no workaround this appears to be an issue preventing multiple input recurrent networks from running on the gpu. (I can try hacking a solution where every entry is a separate input vector, but this increases complexity and possibly might not work in all situations)
The Exception is: Dimensions of matrices being concatenated are not consistent.
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 75)
m{n} = cat(2,c{n,:});
Error in nnGPU.pc (line 52)
xoffset = cell2mat(xoffset');
Error in nncalc.preCalcData>iPreCalcDataForNNDATA2GPU (line 43)
data.Pc = mode.pc(net,data.X,data.Xi,data.Q,data.TS,hints);
Error in nncalc.preCalcData (line 7)
data = iPreCalcDataForNNDATA2GPU(net,data,doPc);
Error in nncalc.setup1>setupImpl (line 176)
calcData = nncalc.preCalcData(matlabMode,matlabHints,net,data,doPc,doPd,calcHints.doFlattenTime);
Error in nncalc.setup1 (line 16)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = setupImpl(calcMode,net,data);
Error in nncalc.setup (line 7)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = nncalc.setup1(calcMode,net,data);
Error in network/train (line 357)
[calcLib,calcNet,net,resourceText] = nncalc.setup(calcMode,net,data);

Respuestas (1)

Amanjit Dulai
Amanjit Dulai el 8 de Sept. de 2017
Instead of using nndata2gpu to prepare your data for GPU training, you can use the 'useGPU' flag. Just change the call to train in the example to the following:
net = train(net,X,T, 'useGPU', 'yes');
  1 comentario
Zachary David
Zachary David el 12 de Sept. de 2017
Editada: Zachary David el 12 de Sept. de 2017
Thanks Amanjit, however the size of the data sets (200 sequences of 7000 entries) I'm using in practice prohibit this method from being practical. In fact, using a batch size of 1 with a sequence length of 7000 never completes.
(this is on a Titan Xp with "computation only" CUDA settings enabled.)

Iniciar sesión para comentar.


Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by