Skip to content

Commit

Permalink
Merge pull request #863 from containers/fix-macos-podman-acceleration
Browse files Browse the repository at this point in the history
Fix macOS GPU acceleration via podman
  • Loading branch information
ericcurtin authored Feb 20, 2025
2 parents 13a1ed8 + a705da6 commit 07d0b6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,17 @@ def setup_container(self, args):

def gpu_args(self, args, runner=False):
gpu_args = []
machine = platform.machine()
if (
os.getenv("HIP_VISIBLE_DEVICES")
or os.getenv("ASAHI_VISIBLE_DEVICES")
or os.getenv("CUDA_VISIBLE_DEVICES")
or os.getenv("INTEL_VISIBLE_DEVICES")
or (
# linux and macOS report aarch64 differently
platform.machine() in {"aarch64", "arm64"}
and os.path.exists("/dev/dri")
# linux and macOS report aarch64 differently, on Apple Silicon
# (arm64), we should have acceleration on regardless.
machine == "arm64"
or (machine == "aarch64" and os.path.exists("/dev/dri"))
)
):
if args.ngl < 0:
Expand Down

0 comments on commit 07d0b6d

Please sign in to comment.