Skip to content

Instantly share code, notes, and snippets.

@eric-unc
Created February 12, 2025 03:29
Show Gist options
  • Select an option

  • Save eric-unc/2e05503dabcb9bcb4ad386a3ab058638 to your computer and use it in GitHub Desktop.

Select an option

Save eric-unc/2e05503dabcb9bcb4ad386a3ab058638 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 940c5916..fde0defc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.21)
+SET(CMAKE_C_COMPILER "clang")
+SET(CMAKE_CXX_COMPILER "/usr/local/opt/llvm@19/bin/clang++")
+
project(Ollama C CXX)
include(CheckLanguage)
diff --git a/discover/gpu_darwin.go b/discover/gpu_darwin.go
index dd5bf6e2..50b6bf0c 100644
--- a/discover/gpu_darwin.go
+++ b/discover/gpu_darwin.go
@@ -6,6 +6,12 @@ package discover
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Foundation -framework CoreGraphics -framework Metal
#include "gpu_info_darwin.h"
+
+#include <Metal/Metal.h>
+
+int isMetalSupported() {
+ return MTLCreateSystemDefaultDevice() != NULL;
+}
*/
import "C"
@@ -23,7 +29,7 @@ const (
func GetGPUInfo() GpuInfoList {
mem, _ := GetCPUMem()
- if runtime.GOARCH == "amd64" {
+ if runtime.GOARCH == "amd64" && C.isMetalSupported() == 0 {
return []GpuInfo{
{
Library: "cpu",
diff --git a/llama/llama.cpp/src/llama-mmap.cpp b/llama/llama.cpp/src/llama-mmap.cpp
index a9932633..040fe93d 100644
--- a/llama/llama.cpp/src/llama-mmap.cpp
+++ b/llama/llama.cpp/src/llama-mmap.cpp
@@ -4,6 +4,8 @@
#include "ggml.h"
+#include <errno.h>
+
#include <cstring>
#include <climits>
#include <stdexcept>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment