trainNetworkで共有GPUメモリを使用する方法
13 views (last 30 days)
Show older comments
セマンティックセグメンテーションのニューラルネットのトレーニングにおいて、共有GPUメモリを使用する方法を教えてください。 共有GPUメモリが使用されないため、ミニバッチを大きくするとすぐにメモリ不足になってしまいます。
コード例:
options = trainingOptions('sgdm', ...
'Momentum', 0.9, ...
'InitialLearnRate', 1e-3, ...
'L2Regularization', 0.0005, ...
'MaxEpochs', 30, ...
'MiniBatchSize', 2, ...
'Shuffle', 'every-epoch', ...
'ExecutionEnvironment', 'auto', ...
'VerboseFrequency', 2);
augmenter = imageDataAugmenter('RandXReflection',true,...
'RandXTranslation', [-10 10], 'RandYTranslation',[-10 10]);
datasource = pixelLabelImageSource(imdsTrain,pxdsTrain,...
'DataAugmentation',augmenter);
[net, info] = trainNetwork(datasource,lgraph,options);
システム構成:
- OS: Windows 10 pro for Workstations 64bit (10.0, ビルド 16299)
- Matlab: 2018a
- GPU: NVIDIA Quadro K620
- Cuda 9.2, V9.2.88
- Neural Network Toolbox: バージョン 11.1 (R2018a)
- Parallel Computing Toolbox: バージョン 6.12 (R2018a)
トレーニング中のGPU使用状況の様子:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190639/image.png)
0 Comments
Answers (1)
Etsuo Maeda
on 21 May 2018
共有GPUメモリを使う機能はありません。 仮に、共有GPUメモリを使えたとしても、計算速度は数桁低下します。 共有GPUメモリは、Windowsがメインメモリ上に割り当てた共有領域であり、当然ながら応答速度はメインメモリと同様です。
ミニバッチサイズを大きくすることが目的であり、速度を全く気にしないのであれば、GPU計算をせず、メインメモリを大量に積んだ状態でCPUで計算をしてください。 ミニバッチサイズを大きくし、かつ高速に計算したい場合は、NVIDIA社のTESLAシリーズが推奨されます。
0 Comments
See Also
Categories
Find more on GPU 計算 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!