源码编译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 生成

相关推荐
j***51893 小时前
Redis 安装及配置教程(Windows)【安装】
数据库·windows·redis
Karl_wei4 小时前
桌面应用开发,Flutter 与 Electron如何选
windows·flutter·electron
未名编程7 小时前
Windows 下如何部署 Nacos 并导入配置文件
java·windows
2501_941885969 小时前
智能物流配送优化系统开发与多语言微服务实践:Python、Java、C++与Go全栈实现解析
windows
p***s9110 小时前
Windows安装Rust环境(详细教程)
开发语言·windows·rust
lihui_cbdd11 小时前
幽灵卡顿:Windows 11 “数据正常但系统卡死“ 的深度排查与终极优化指南
windows
林抒11 小时前
(2025版)MongoDB 8.0.13 版本安装与配置(Windows 版)保姆级教程
windows·mongodb·nosql数据库
szxinmai主板定制专家12 小时前
柔宇柔性显示屏+x86、arm显示解决方案,还有库存
arm开发·人工智能·fpga开发
vortex513 小时前
Windows 下 Git Bash 终端高效配置指南
windows·git·bash
开朗觉觉14 小时前
poi导出大量数据到Excel
windows·excel