aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/patches/qwentts.cpp.patch
blob: fea7dec42bb2234fd7afd20cf7de976ec9be5b5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/buildall.sh b/buildall.sh
index 8ce58a6..a461d07 100755
--- a/buildall.sh
+++ b/buildall.sh
@@ -4,7 +4,15 @@ rm -rf build
 mkdir build
 cd build
 
-export PATH=/usr/local/cuda/bin:$PATH
+# Find nvcc: honor CUDACXX/PATH, then fall back to common install locations
+NVCC="${CUDACXX:-$(command -v nvcc)}"
+if [ -z "$NVCC" ]; then
+  for c in /opt/cuda/bin/nvcc /usr/local/cuda/bin/nvcc; do
+    [ -x "$c" ] && NVCC="$c" && break
+  done
+fi
+# Make sure the detected CUDA bin dir is on PATH for the rest of the toolkit
+[ -n "$NVCC" ] && export PATH="$(dirname "$NVCC"):$PATH"
 
-cmake .. -DGGML_CPU_ALL_VARIANTS=ON -DGGML_CUDA=ON -DGGML_VULKAN=ON -DGGML_BACKEND_DL=ON
+cmake .. -DGGML_CPU_ALL_VARIANTS=ON -DGGML_CUDA=ON -DGGML_VULKAN=ON -DGGML_BACKEND_DL=ON ${NVCC:+-DCMAKE_CUDA_COMPILER="$NVCC"}
 cmake --build . --config Release -j "$(nproc)"
diff --git a/buildcuda.sh b/buildcuda.sh
index 67f711f..242bb39 100755
--- a/buildcuda.sh
+++ b/buildcuda.sh
@@ -4,5 +4,13 @@ rm -rf build
 mkdir build
 cd build
 
-cmake .. -DGGML_CUDA=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
+# Find nvcc: honor CUDACXX/PATH, then fall back to common install locations
+NVCC="${CUDACXX:-$(command -v nvcc)}"
+if [ -z "$NVCC" ]; then
+  for c in /opt/cuda/bin/nvcc /usr/local/cuda/bin/nvcc; do
+    [ -x "$c" ] && NVCC="$c" && break
+  done
+fi
+
+cmake .. -DGGML_CUDA=ON ${NVCC:+-DCMAKE_CUDA_COMPILER="$NVCC"}
 cmake --build . --config Release -j "$(nproc)"