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

相关推荐
bug和崩溃我都要2 小时前
QT 开发的专业截图录屏工具 - macOS版 / Windows版
windows·qt·mac·录屏·截屏
kimloner2 小时前
开源一个 376KB 的 Windows 桌面小工具:便签 + 截图标注 + OCR + 待办提醒(C# / WinForms)
windows·开源·c#·ocr·winforms
摸鱼 特供版3 小时前
一款边录边标注的轻量截图录屏工具
windows·学习·电脑·音视频·软件需求
夜雪一千3 小时前
Python 生成模拟地址数据:Faker之外的备选库
网络·windows·python
无忧.芙桃4 小时前
C++语言原理与实践(十二):list类的底层实现
c++·windows·list
Vex2une5 小时前
PowerShell ISE 到 VS Code 迁移史:从集成脚本环境到现代编辑器工作流
windows·vscode·powershell·powershell ise·powershell 扩展·powershell 7·脚本编辑器
空 白II5 小时前
10.10 大语言模型研究简报:Microsoft 发布 Windows 端侧混合智能架构
windows·microsoft·语言模型
大貔貅喝啤酒6 小时前
Windows 安装 使用JMeter 教程
windows·jmeter
报错小能手7 小时前
Channel面试题。Sync面试题
linux·服务器·windows
闭着眼刷牙7 小时前
pc接入rndis等网卡设备后卡死几分钟,已解决
windows