源码编译llama.cpp for windows on arm

源码编译llama.cpp for windows on arm

这里有编译好的,直接下载使用

https://github.com/turingevo/llama.cpp-build/releases

1 先编译openblas for windows on arm

查看我的文章
《源码编译 openblas for windows on arm》

2 启用OpenBlas加速

上一步openblas 安装到路径 C:/workspace/program/openblas

原理 blas 加速是通过编译ggml提供的

所以修改llama.cpp/ggml/src/CMakeLists.txt ,在这一行代码if (GGML_BLAS) 前面添加以下代码:

bash 复制代码
# add custom blas
if (CUSTOM_BLAS)
	set(BLAS_ROOT "C:/workspace/program/openblas")
	set(BLAS_INCLUDE_DIRS
        "${BLAS_ROOT}/include/"
        "${BLAS_ROOT}/include/openblas"
    )
	set(BLAS_LIBRARIES "${BLAS_ROOT}/lib/openblas.lib")
	list(APPEND GGML_CDEF_PUBLIC GGML_USE_BLAS)
	
	set(GGML_HEADERS_BLAS ../include/ggml-blas.h)
	set(GGML_SOURCES_BLAS ggml-blas.cpp)
	
    list(APPEND GGML_EXTRA_LIBS_PRIVATE ${BLAS_LIBRARIES})
    list(APPEND GGML_EXTRA_INCLUDES     ${BLAS_INCLUDE_DIRS})
endif()

然后编译时指定 CUSTOM_BLAS=ON

  • 使用命令行:
bash 复制代码
cmake -B build -DGGML_BLAS=OFF  -DCUSTOM_BLAS=ON
cmake --build build --config Release
  • 如果使用cmake-gui
    编译器 Visual Studio 17 2022
    Use default native compilers

    然后点击 Configure 生成配置
    去掉 GGML_BLAS ,勾选CUSTOM_BLAS

点击 Generate 生成

然后open project, 选择 vs 2022 打开

选择 Release ARM64 ,选中项目 ALL_BUILD 生成

相关推荐
阿白的白日梦1 天前
winget基础管理---更新/修改源为国内源
windows
埃博拉酱5 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
唐宋元明清21885 天前
.NET 本地Db数据库-技术方案选型
windows·c#
加号36 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
tryCbest6 天前
Windows环境下配置pip镜像源
windows·pip
呉師傅6 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
百事牛科技6 天前
保护文档安全:PDF限制功能详解与实操
windows·pdf
一个人旅程~6 天前
如何用命令行把win10/win11设置为长期暂停更新?
linux·windows·经验分享·电脑
一个假的前端男6 天前
[特殊字符] Flutter 安装完整指南 Windows—— 2026最新版
windows·flutter
倚肆6 天前
在 Windows Docker 中安装并配置 Nginx (映射 Windows 端口与路径)
windows·nginx·docker