Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

2 次查看(过去 30 天)
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)

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!