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

相关推荐
优雅鹅2 小时前
ARM、AArch64、amd64、x86_64、x86有什么区别?
arm开发·学习
带娃的IT创业者4 小时前
Windows 平台上基于 MCP 构建“文心一言+彩云天气”服务实战
人工智能·windows·文心一言·mcp
Jina AI5 小时前
让 llama.cpp 支持多模态向量模型
llama
wyw00005 小时前
大模型微调之LLaMA-Factory实战
llama
2202_756749695 小时前
LLM大模型-大模型微调(常见微调方法、LoRA原理与实战、LLaMA-Factory工具部署与训练、模型量化QLoRA)
人工智能·深度学习·llama
JoannaJuanCV5 小时前
大模型训练框架:LLaMA-Factory框架
llama·大模型训练·llama factory
csdn_aspnet6 小时前
Windows Node.js 安装及环境配置详细教程
windows·node.js
摇滚侠7 小时前
java语言中,list<String>转成字符串,逗号分割;List<Integer>转字符串,逗号分割
java·windows·list
Source.Liu7 小时前
【Pywinauto库】12.2 pywinauto.element_info 后端内部实施模块
windows·python·自动化
Source.Liu7 小时前
【Pywinauto库】12.1 pywinauto.backend 后端内部实施模块
开发语言·windows·python·自动化