Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

how to choose specific GPUs on multi-GPUs server to train my CNN?

2 views (last 30 days)
Our lab has a server with 8 GPUs(0,1,2,...,7),I want to choose No.1 and No.3 GPUs to train my CNN,how to do? The code is shown below.thanks
clear
trainingData = imageDatastore('C:\Users\Administrator\Desktop\matlab code\Training',... 'IncludeSubfolders',true,'LabelSource','foldernames');
testData = imageDatastore('C:\Users\Administrator\Desktop\matlab code\Test',... 'IncludeSubfolders',true,'LabelSource','foldernames');
layers = [ ... imageInputLayer([227 227 3]) convolution2dLayer(5,8) reluLayer() maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,48)
reluLayer()
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,48)
reluLayer()
dropoutLayer('Name','drop1')
fullyConnectedLayer(2)
softmaxLayer()
classificationLayer()];
options = trainingOptions('sgdm',...
'InitialLearnRate',0.0001,...
'MiniBatchSize',16,...
'MaxEpoch',1,...
'ExecutionEnvironment','multi-gpu')
net = trainNetwork(trainingData,layers,options);
YTest = classify(net,testData);
TTest = testData.Labels;
accuracy = sum(YTest == TTest)/numel(TTest)

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!