Training NN with single precision data on GPU
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cameron Lee
am 16 Jan. 2020
Kommentiert: Cameron Lee
am 21 Feb. 2020
I am trying to use fitnet to train a network on my GPU using single-precision input data (X and T). However, this always returns an error, which starts with:
"Error using nnGPUOp.bg (line 134) Variable 'perfs1' changed type. Consider renaming variable on left hand side of assignment."
This only seems to be a problem when using single-precision data AND the GPU. When I train using double-precision on GPU, it works fine, and when I use single- or double-precision data on the CPU, it also works fine.
Anyone found a way around this?
3 Kommentare
Akzeptierte Antwort
Raunak Gupta
am 19 Feb. 2020
Bearbeitet: Raunak Gupta
am 19 Feb. 2020
Hi,
The single precision GPU training can only be done in the ‘nnGPU’ calculation mode. By default train uses ‘nnGPUOp’ which doesn’t support single precision GPU Training.
As a workaround, you may do single precision GPU training by any of the two ways mentioned below:
- You can use the nndata2gpu function:
% Here x,t are original double precision data
net = configure(net,x,t);
sx = nndata2gpu(x,'single');
st = nndata2gpu(t,'single');
[net,tr] = train(net,sx,st,'useGPU','yes');
- You can specify single precision GPU training:
% Here x,t are single precision data
[net,tr] = train(net,x,t,nnGPU('precision','single'));
Hope it helps.
3 Kommentare
Raunak Gupta
am 20 Feb. 2020
Hi Cameron,
The speed up will not happen because by using single-precision instead of double-precision the memory used by the GPU decreases which doesn't translates to speed. Instead if you have more available memory maybe increasing the batch-size (In Case of Deep Neural Network like CNNs) would speed up the code.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!