|
@@ -178,6 +178,48 @@ GeForce RTX 3070 8.6
|
|
|
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="86;89"
|
|
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="86;89"
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+### Overriding the CUDA Version
|
|
|
|
|
+
|
|
|
|
|
+If you have multiple CUDA installations on your system and want to compile llama.cpp for a specific one, e.g. for CUDA 11.7 installed under `/opt/cuda-11.7`:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_COMPILER=/opt/cuda-11.7/bin/nvcc -DCMAKE_INSTALL_RPATH="/opt/cuda-11.7/lib64;\$ORIGIN" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+#### Fixing Compatibility Issues with Old CUDA and New glibc
|
|
|
|
|
+
|
|
|
|
|
+If you try to use an old CUDA version (e.g. v11.7) with a new glibc version you can get errors like this:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+/usr/include/bits/mathcalls.h(83): error: exception specification is
|
|
|
|
|
+ incompatible with that of previous function "cospi"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /opt/cuda-11.7/bin/../targets/x86_64-linux/include/crt/math_functions.h(5545):
|
|
|
|
|
+ here
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+It seems the least bad solution is to patch the CUDA installation to declare the correct signatures.
|
|
|
|
|
+Replace the following lines in `/path/to/your/cuda/installation/targets/x86_64-linux/include/crt/math_functions.h`:
|
|
|
|
|
+
|
|
|
|
|
+```C++
|
|
|
|
|
+// original lines
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x);
|
|
|
|
|
+
|
|
|
|
|
+// edited lines
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x) noexcept (true);
|
|
|
|
|
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x) noexcept (true);
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
### Runtime CUDA environmental variables
|
|
### Runtime CUDA environmental variables
|
|
|
|
|
|
|
|
You may set the [cuda environmental variables](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars) at runtime.
|
|
You may set the [cuda environmental variables](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars) at runtime.
|