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

相关推荐
EnCi Zheng2 小时前
SpringBoot + PostgreSQL 密码认证失败 Windows 系统解决方案
windows·spring boot·postgresql
德育处主任Pro3 小时前
前端玩转大模型,DeepSeek-R1 蒸馏 Llama 模型的 Bedrock 部署
前端·llama
Damon小智3 小时前
玩转CodeX:CodeX安装教程(Windows+Linux+MacOS)
linux·windows·macos·ai·ai编程·codex·gpt-5
用户31187945592184 小时前
DOpusInstall-13.2.exe 安装方法,简单几步完成
windows
szxinmai主板定制专家7 小时前
一种基于 RK3568+AI 的国产化充电桩安全智能交互终端的设计与实现,终端支持各种复杂的交互功能和实时数据处理需求
arm开发·人工智能·嵌入式硬件·安全
张某人的胡思乱想7 小时前
Create/Assemble/Link x64 Windows
windows
ThisIsMirror8 小时前
CompletableFuture并行任务超时处理模板
java·windows·python
szxinmai主板定制专家8 小时前
基于 ZYNQ ARM+FPGA+AI YOLOV4 的电网悬垂绝缘子缺陷检测系统的研究
arm开发·人工智能·嵌入式硬件·yolo·fpga开发
say_fall9 小时前
精通C语言(2.结构体)(内含彩虹)
c语言·开发语言·windows
长源Gingko9 小时前
Windows中在QTCreator中调试,提示缺少debug information files问题的解决
windows·qt