You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to build llama.cpp you have four different options.
10
+
The following sections describe how to build with different backends and options.
11
11
12
-
- Using `CMake`:
13
-
14
-
```bash
15
-
cmake -B build
16
-
cmake --build build --config Release
17
-
```
18
-
19
-
**Notes**:
12
+
## CPU-only Build
20
13
21
-
- For faster compilation, add the `-j` argument to run multiple jobs in parallel. For example, `cmake --build build --config Release -j 8` will run 8 jobs in parallel.
22
-
- For faster repeated compilation, install [ccache](https://ccache.dev/).
23
-
- For debug builds, there are two cases:
14
+
Build llama.cpp using `CMake`:
24
15
25
-
1. Single-config generators (e.g. default = `Unix Makefiles`; note that they just ignore the `--config` flag):
26
-
27
-
```bash
28
-
cmake -B build -DCMAKE_BUILD_TYPE=Debug
29
-
cmake --build build
30
-
```
16
+
```bash
17
+
cmake -B build
18
+
cmake --build build --config Release
19
+
```
31
20
32
-
2. Multi-config generators (`-G` param set to Visual Studio, XCode...):
21
+
**Notes**:
33
22
34
-
```bash
35
-
cmake -B build -G "Xcode"
36
-
cmake --build build --config Debug
37
-
```
38
-
- Building for Windows (x86, x64 and arm64) with MSVC or clang as compilers:
39
-
- Install Visual Studio 2022, e.g. via the [Community Edition](https://visualstudio.microsoft.com/de/vs/community/). In the installer, selectat least the following options (this also automatically installs the required additional tools like CMake,...):
40
-
- Tab Workload: Desktop-development with C++
41
-
- Tab Components (select quickly via search): C++-_CMake_ Tools for Windows, _Git_ for Windows, C++-_Clang_ Compiler for Windows, MS-Build Support for LLVM-Toolset (clang)
42
-
- Please remember to always use a Developer Command Prompt / PowerShell for VS2022 for git, build, test
Note: Building for arm64 could also be done just with MSVC (with the build-arm64-windows-MSVC preset, or the standard CMake build instructions). But MSVC does not support inline ARM assembly-code, used e.g. for the accelerated Q4_0_4_8 CPU kernels.
23
+
- For faster compilation, add the `-j` argument to run multiple jobs in parallel. For example, `cmake --build build --config Release -j 8` will run 8 jobs in parallel.
24
+
- For faster repeated compilation, install [ccache](https://ccache.dev/).
25
+
- For debug builds, there are two cases:
49
26
50
-
- Using `gmake` (FreeBSD):
27
+
1. Single-config generators (e.g. default = `Unix Makefiles`; note that they just ignore the `--config` flag):
51
28
52
-
1. Install and activate [DRM in FreeBSD](https://wiki.freebsd.org/Graphics)
- Building for Windows (x86, x64 and arm64) with MSVC or clang as compilers:
41
+
- Install Visual Studio 2022, e.g. via the [Community Edition](https://visualstudio.microsoft.com/de/vs/community/). In the installer, selectat least the following options (this also automatically installs the required additional tools like CMake,...):
42
+
- Tab Workload: Desktop-development with C++
43
+
- Tab Components (select quickly via search): C++-_CMake_ Tools for Windows, _Git_ for Windows, C++-_Clang_ Compiler for Windows, MS-Build Support for LLVM-Toolset (clang)
44
+
- Please remember to always use a Developer Command Prompt / PowerShell for VS2022 for git, build, test
Note: Building for arm64 could also be done just with MSVC (with the build-arm64-windows-MSVC preset, or the standard CMake build instructions). But MSVC does not support inline ARM assembly-code, used e.g. for the accelerated Q4_0_4_8 CPU kernels.
61
51
62
52
## Metal Build
63
53
64
54
On MacOS, Metal is enabled by default. Using Metal makes the computation run on the GPU.
65
-
To disable the Metal build at compile time use the `GGML_NO_METAL=1` flag or the `GGML_METAL=OFF` cmake option.
55
+
To disable the Metal build at compile time use the `-DGGML_METAL=OFF` cmake option.
66
56
67
57
When built with Metal support, you can explicitly disable GPU inference with the `--n-gpu-layers|-ngl 0` command-line
68
58
argument.
@@ -159,9 +149,9 @@ The environment variable `GGML_CUDA_ENABLE_UNIFIED_MEMORY=1` can be used to enab
159
149
160
150
Most of the compilation options available for CUDA should also be available for MUSA, though they haven't been thoroughly tested yet.
161
151
162
-
### hipBLAS
152
+
### HIP
163
153
164
-
This provides BLAS acceleration on HIP-supported AMD GPUs.
154
+
This provides GPU acceleration on HIP-supported AMD GPUs.
165
155
Make sure to have ROCm installed.
166
156
You can download it from your Linux distro's package manager or from here: [ROCm Quick Start (Linux)](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/quick-start.html#rocm-install-quick).
167
157
@@ -227,6 +217,12 @@ EOF
227
217
228
218
```
229
219
220
+
Switch into the `llama.cpp` directory and build using CMake.
221
+
```sh
222
+
cmake -B build -DGGML_VULKAN=ON
223
+
cmake --build build --config Release
224
+
```
225
+
230
226
#### Git Bash MINGW64
231
227
232
228
Download and install [`Git-SCM`](https://git-scm.com/downloads/win) with the default settings
0 commit comments