Skip to content

Commit

Permalink
fix missing param to attach gpu
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed Apr 9, 2024
1 parent f8c7eaa commit 0b7f80c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/DeployActions/DockerActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ public function buildDeployParams(DaemonConfig $daemonConfig, array $appInfo): a
'port' => $appInfo['port'],
'net' => $deployConfig['net'] ?? 'host',
'env' => $envs,
'computeDevice' => $deployConfig['computeDevice'] ?? null,
'devices' => $devices,
'deviceRequests' => $deviceRequests,
];
Expand All @@ -413,10 +414,10 @@ public function buildDeployEnvs(array $params, array $deployConfig): array {
];

// Always set COMPUTE_DEVICE=cpu|cuda|rocm
$autoEnvs[] = sprintf('COMPUTE_DEVICE=%s', $params['computeDevice']['id']);
$autoEnvs[] = sprintf('COMPUTE_DEVICE=%s', $deployConfig['computeDevice']['id']);
// Add required GPU runtime envs if daemon configured to use GPU
if (isset($params['computeDevice'])) {
if ($params['computeDevice']['id'] === 'cuda') {
if (isset($deployConfig['computeDevice'])) {
if ($deployConfig['computeDevice']['id'] === 'cuda') {
$autoEnvs[] = sprintf('NVIDIA_VISIBLE_DEVICES=%s', 'all');
$autoEnvs[] = sprintf('NVIDIA_DRIVER_CAPABILITIES=%s', 'compute,utility');
}
Expand Down

0 comments on commit 0b7f80c

Please sign in to comment.