Force CPU Parallel pool
1 回表示 (過去 30 日間)
古いコメントを表示
My GPU is a GTX 970 with only 4 Gb of availble memory. I would like to force training of my UNET segmentation network on the CPU 16 core ryzen 5950x with availble system memory instead.
How can I force a multicore/multithreaded parallell pool on the CPU. By default matlab selects GPU and experiences memory errors.
Is there a way to "hide" the GPU from matlab?
options = trainingOptions('adam', ...
'InitialLearnRate',2e-4, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropFactor',0.85, ...
'LearnRateDropPeriod', 3, ...
'MaxEpochs',60, ...
'MiniBatchSize',20, ...
'Shuffle', 'every-epoch', ...
'VerboseFrequency', 5, ...
'ValidationData', Validationds, ...
'ValidationFrequency', 30, ...
'ExecutionEnvironment', 'parallel', ...
'Plots','training-progress');
0 件のコメント
回答 (2 件)
Joss Knight
2022 年 1 月 17 日
編集済み: Joss Knight
2022 年 1 月 17 日
You should use 'ExecutionEnvironment','cpu' for training on your local machine. This is multithreaded and will use all your cores. Parallel training on CPU is only useful for multinode clusters.
In practice you will likely find that your 16 core CPU is still slower than training on your GTX 970 with the MiniBatchSize reduced so that you can fit into its memory - worth checking though.
0 件のコメント
Edric Ellis
2022 年 1 月 17 日
There's no direct way to specify this using trainingOptions, but what you can do is disable the GPUs on the workers by running this command in your desktop MATLAB before creating the parallel pool:
setenv('CUDA_VISIBLE_DEVICES', '')
You can then check that this has worked by running
spmd
gpuDeviceCount
end
This should return 0 on each worker.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Parallel and Cloud についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!