Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
f4bf1d51
Commit
f4bf1d51
authored
Jan 14, 2024
by
Alexander F. Rødseth
Browse files
Let gpu.go and gen_linux.sh also find CUDA on Arch Linux
parent
557110d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
+27
-24
gpu/gpu.go
gpu/gpu.go
+1
-0
llm/generate/gen_linux.sh
llm/generate/gen_linux.sh
+26
-24
No files found.
gpu/gpu.go
View file @
f4bf1d51
...
...
@@ -39,6 +39,7 @@ var CudaLinuxGlobs = []string{
"/usr/lib/x86_64-linux-gnu/libnvidia-ml.so*"
,
"/usr/lib/wsl/lib/libnvidia-ml.so*"
,
"/opt/cuda/lib64/libnvidia-ml.so*"
,
"/opt/cuda/targets/x86_64-linux/lib/stubs/libnvidia-ml.so*"
,
"/usr/lib*/libnvidia-ml.so*"
,
"/usr/local/lib*/libnvidia-ml.so*"
,
"/usr/lib/aarch64-linux-gnu/nvidia/current/libnvidia-ml.so*"
,
...
...
llm/generate/gen_linux.sh
View file @
f4bf1d51
...
...
@@ -109,31 +109,33 @@ else
echo
"Skipping CPU generation step as requested"
fi
if
[
-d
/usr/local/cuda/lib64/
]
;
then
echo
"CUDA libraries detected - building dynamic CUDA library"
init_vars
CUDA_MAJOR
=
$(
ls
/usr/local/cuda/lib64/libcudart.so.
*
|
head
-1
|
cut
-f3
-d
.
||
true
)
if
[
-n
"
${
CUDA_MAJOR
}
"
]
;
then
CUDA_VARIANT
=
_v
${
CUDA_MAJOR
}
for
cudalibpath
in
"/usr/local/cuda/lib64"
"/opt/cuda/targets/x86_64-linux/lib"
;
do
if
[
-d
"
$cudalibpath
"
]
;
then
echo
"CUDA libraries detected - building dynamic CUDA library"
init_vars
CUDA_MAJOR
=
$(
find
"
$cudalibpath
"
-name
'libcudart.so.*'
-print
|
head
-1
|
cut
-f3
-d
.
||
true
)
if
[
-n
"
${
CUDA_MAJOR
}
"
]
;
then
CUDA_VARIANT
=
"_v
${
CUDA_MAJOR
}
"
fi
CMAKE_DEFS
=
"-DLLAMA_CUBLAS=on
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
"
BUILD_DIR
=
"
${
LLAMACPP_DIR
}
/build/linux/cuda
${
CUDA_VARIANT
}
"
CUDA_LIB_DIR
=
"
$cudalibpath
"
build
install
gcc
-fPIC
-g
-shared
-o
"
${
BUILD_DIR
}
/lib/libext_server.so"
\
-Wl
,--whole-archive
\
"
${
BUILD_DIR
}
/lib/libext_server.a"
\
"
${
BUILD_DIR
}
/lib/libcommon.a"
\
"
${
BUILD_DIR
}
/lib/libllama.a"
\
-Wl
,--no-whole-archive
\
"
${
CUDA_LIB_DIR
}
/libcudart_static.a"
\
"
${
CUDA_LIB_DIR
}
/libcublas_static.a"
\
"
${
CUDA_LIB_DIR
}
/libcublasLt_static.a"
\
"
${
CUDA_LIB_DIR
}
/libcudadevrt.a"
\
"
${
CUDA_LIB_DIR
}
/libculibos.a"
\
-lrt
-lpthread
-ldl
-lstdc
++
-lm
fi
CMAKE_DEFS
=
"-DLLAMA_CUBLAS=on
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
"
BUILD_DIR
=
"
${
LLAMACPP_DIR
}
/build/linux/cuda
${
CUDA_VARIANT
}
"
CUDA_LIB_DIR
=
/usr/local/cuda/lib64
build
install
gcc
-fPIC
-g
-shared
-o
${
BUILD_DIR
}
/lib/libext_server.so
\
-Wl
,--whole-archive
\
${
BUILD_DIR
}
/lib/libext_server.a
\
${
BUILD_DIR
}
/lib/libcommon.a
\
${
BUILD_DIR
}
/lib/libllama.a
\
-Wl
,--no-whole-archive
\
${
CUDA_LIB_DIR
}
/libcudart_static.a
\
${
CUDA_LIB_DIR
}
/libcublas_static.a
\
${
CUDA_LIB_DIR
}
/libcublasLt_static.a
\
${
CUDA_LIB_DIR
}
/libcudadevrt.a
\
${
CUDA_LIB_DIR
}
/libculibos.a
\
-lrt
-lpthread
-ldl
-lstdc
++
-lm
fi
done
if
[
-z
"
${
ROCM_PATH
}
"
]
;
then
# Try the default location in case it exists
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment