1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

feat(gpu) EE-3191 Add GPU support for containers (#7146)

This commit is contained in:
congs 2022-07-18 11:02:14 +12:00 committed by GitHub
parent f0456cbf5f
commit 4997e9c7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 758 additions and 10 deletions

View file

@ -77,6 +77,23 @@ angular.module('portainer.docker').controller('ContainerController', [
$state.reload();
};
$scope.computeDockerGPUCommand = () => {
const gpuOptions = _.find($scope.container.HostConfig.DeviceRequests, function (o) {
return o.Driver === 'nvidia' || o.Capabilities[0][0] === 'gpu';
});
if (!gpuOptions) {
return 'No GPU config found';
}
let gpuStr = 'all';
if (gpuOptions.Count !== -1) {
gpuStr = `"device=${_.join(gpuOptions.DeviceIDs, ',')}"`;
}
// we only support a single set of capabilities for now
// creation UI needs to be reworked in order to support OR combinations of AND capabilities
const capStr = `"capabilities=${_.join(gpuOptions.Capabilities[0], ',')}"`;
return `${gpuStr},${capStr}`;
};
var update = function () {
var nodeName = $transition$.params().nodeName;
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);