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

相关推荐
喜欢吃豆17 小时前
llama.cpp 全方位技术指南:从底层原理到实战部署
人工智能·语言模型·大模型·llama·量化·llama.cpp
橘子1318 小时前
Linux网络基础(一)
linux·网络·arm开发
习惯就好zz1 天前
WSL2 安装Ubuntu卡在安装进度0%无响应问题解决
linux·windows·ubuntu·wsl·wsl2
仰望—星空1 天前
MiniEngine学习笔记 : CommandListManager
c++·windows·笔记·学习·cg·direct3d
ue星空1 天前
Windows内核函数使用
windows
业余幻想家1 天前
Windows10/Windows11家庭版系统关闭自动更新
运维·windows
阿猿收手吧!1 天前
windows本机vscode通过ssh免密登录远程linux服务器 && git push/pull 免密
服务器·windows·vscode
zxm85131 天前
如何在Windows系统中加入程序自启动
windows
skywalk81631 天前
在星河社区部署大模型unsloth/Llama-3.3-70B-Instruct-GGUF
llama·aistudio
鹿子沐1 天前
LlamaFactory微调效果与vllm部署效果不一致
人工智能·llama