Skip to content

Commit

Permalink
CTX-6655: Changes regarding discussions with Dusko. If user is using …
Browse files Browse the repository at this point in the history
…docker desktop on linux he can't start coretex gpu image, prompt is edited with appropriate message.
  • Loading branch information
Bogdan Tintor committed Aug 26, 2024
1 parent 6dc58a3 commit 7b84fea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions coretex/cli/modules/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def configureNode(advanced: bool) -> NodeConfiguration:
else:
nodeConfig.image = "coretexai/coretex-node"

if isGPUAvailable():
if isGPUAvailable() and not docker.isDockerDesktop():
nodeConfig.allowGpu = ui.clickPrompt("Do you want to allow the Node to access your GPU? (Y/n)", type = bool, default = True)
else:
nodeConfig.allowGpu = False
Expand All @@ -399,10 +399,10 @@ def configureNode(advanced: bool) -> NodeConfiguration:

if shouldUpdateDaemon:
userApproval = ui.clickPrompt(
"Node container could randomly lose access to GPU. "
"The daemon.json file does not contain the necessary cgroup fix "
"NVIDIA has a bug where a docker container running Coretex Node can lose access to GPU "
"(https://github.com/NVIDIA/nvidia-container-toolkit/issues/48). "
"Do you want to update the file to include the cgroup fix? (Y/n)",
"\nDo you want Coretex CLI to apply a workaround for this bug "
"(NOTE: This requires docker daemon restart)? (Y/n)",
type = bool,
default = True
)
Expand Down
8 changes: 8 additions & 0 deletions coretex/utils/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ def getLogs(name: str, tail: Optional[int], follow: bool, timestamps: bool) -> N
command(runCommand)


def isDockerDesktop() -> bool:
try:
_, output, _ = command(["docker", "context", "show"], ignoreStdout = True, ignoreStderr = True)
return output.strip() == "desktop-linux"
except:
return False


def isDaemonFileUpdated() -> bool:
daemonFile = "/etc/docker/daemon.json"
cGroupFix = "native.cgroupdriver=cgroupfs"
Expand Down

0 comments on commit 7b84fea

Please sign in to comment.