필터 지우기
필터 지우기

How to specify the number of gpu to train a deep learning model.

조회 수: 1 (최근 30일)
qi lu
qi lu 2020년 10월 9일
답변: Shashank Gupta 2020년 10월 12일
I have four gpus. I use the following command to train a deep learning model.
[net,Info] = trainNetwork(X_train,Y_train,lgraph,options);
  1. How to specify a gpu to train a deep learning model. When I set the 'ExecutionEnvironment' in options to 'gpu'. The defult gpu is gpu 1. Now I want to train a deep learning model at gpu 0 or gpu1, how to operate.
  2. How to specify the number of gpus to train a deep learning model. In most cases, I want to train a model with 2 gpus rather than 4 gpus. Is there any workarounds?

채택된 답변

Shashank Gupta
Shashank Gupta 2020년 10월 12일
There area multiple ways to set gpu prefernces for your training, one of them is using gpuDevice function. Look at the documentation you will get clear idea on how to set different gpu's at the time of training. Although let me give a small piece of code for you to understand the function.
% Set the execution environment to use GPU.
executionEnvironment = "gpu";
% set 3rd gpu from the GPU pool list.
gpuDevice(3);
Also check out this link to get better idea on how to use multiple GPU at the same time. you can also refer to this.
Hope this helps you.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by