diff --git a/ggml/src/ggml-cpu/ggml-cpu.cpp b/ggml/src/ggml-cpu/ggml-cpu.cpp index 09f8382b988a4..905cfcd34f35f 100644 --- a/ggml/src/ggml-cpu/ggml-cpu.cpp +++ b/ggml/src/ggml-cpu/ggml-cpu.cpp @@ -23,6 +23,14 @@ #include #endif +#if defined(__FreeBSD__) +#include +#include +#include +#include +#include +#endif + #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #ifndef NOMINMAX @@ -285,6 +293,14 @@ struct ggml_backend_cpu_device_context { } fclose(f); } +#elif defined(__FreeBSD__) + char buf[1024]; + size_t size = sizeof(buf); + int rc = sysctlbyname("hw.model", buf, &size, nullptr, 0); + if (rc == 0) + description = buf; + else + std::cerr << "error: sysctlbyname(hw.model) failed: " << strerror(errno) << std::endl; #elif defined(_WIN32) HKEY hKey; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,