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
e02ecfb6
Unverified
Commit
e02ecfb6
authored
Jan 27, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jan 27, 2024
Browse files
Merge pull request #2116 from dhiltgen/cc_50_80
Add support for CUDA 5.0 cards
parents
c8059b4d
a447a083
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
6 deletions
+15
-6
docs/development.md
docs/development.md
+2
-1
gpu/gpu.go
gpu/gpu.go
+3
-3
llm/generate/gen_common.sh
llm/generate/gen_common.sh
+3
-0
llm/generate/gen_linux.sh
llm/generate/gen_linux.sh
+1
-1
llm/generate/gen_windows.ps1
llm/generate/gen_windows.ps1
+6
-1
No files found.
docs/development.md
View file @
e02ecfb6
...
@@ -50,7 +50,8 @@ development and runtime packages.
...
@@ -50,7 +50,8 @@ development and runtime packages.
Typically the build scripts will auto-detect CUDA, however, if your Linux distro
Typically the build scripts will auto-detect CUDA, however, if your Linux distro
or installation approach uses unusual paths, you can specify the location by
or installation approach uses unusual paths, you can specify the location by
specifying an environment variable
`CUDA_LIB_DIR`
to the location of the shared
specifying an environment variable
`CUDA_LIB_DIR`
to the location of the shared
libraries, and
`CUDACXX`
to the location of the nvcc compiler.
libraries, and
`CUDACXX`
to the location of the nvcc compiler. You can customize
set set of target CUDA architectues by setting
`CMAKE_CUDA_ARCHITECTURES`
(e.g. "50;60;70")
Then generate dependencies:
Then generate dependencies:
...
...
gpu/gpu.go
View file @
e02ecfb6
...
@@ -30,8 +30,8 @@ type handles struct {
...
@@ -30,8 +30,8 @@ type handles struct {
var
gpuMutex
sync
.
Mutex
var
gpuMutex
sync
.
Mutex
var
gpuHandles
*
handles
=
nil
var
gpuHandles
*
handles
=
nil
// With our current CUDA compile flags,
5.2 and older
will not work properly
// With our current CUDA compile flags,
older than 5.0
will not work properly
const
CudaComputeM
ajorMin
=
6
var
CudaComputeM
in
=
[
2
]
C
.
int
{
5
,
0
}
// Possible locations for the nvidia-ml library
// Possible locations for the nvidia-ml library
var
CudaLinuxGlobs
=
[]
string
{
var
CudaLinuxGlobs
=
[]
string
{
...
@@ -142,7 +142,7 @@ func GetGPUInfo() GpuInfo {
...
@@ -142,7 +142,7 @@ func GetGPUInfo() GpuInfo {
if
cc
.
err
!=
nil
{
if
cc
.
err
!=
nil
{
slog
.
Info
(
fmt
.
Sprintf
(
"error looking up CUDA GPU compute capability: %s"
,
C
.
GoString
(
cc
.
err
)))
slog
.
Info
(
fmt
.
Sprintf
(
"error looking up CUDA GPU compute capability: %s"
,
C
.
GoString
(
cc
.
err
)))
C
.
free
(
unsafe
.
Pointer
(
cc
.
err
))
C
.
free
(
unsafe
.
Pointer
(
cc
.
err
))
}
else
if
cc
.
major
>
=
CudaComputeM
ajorMin
{
}
else
if
cc
.
major
>
CudaComputeM
in
[
0
]
||
(
cc
.
major
==
CudaComputeMin
[
0
]
&&
cc
.
minor
>=
CudaComputeMin
[
1
])
{
slog
.
Info
(
fmt
.
Sprintf
(
"CUDA Compute Capability detected: %d.%d"
,
cc
.
major
,
cc
.
minor
))
slog
.
Info
(
fmt
.
Sprintf
(
"CUDA Compute Capability detected: %d.%d"
,
cc
.
major
,
cc
.
minor
))
resp
.
Library
=
"cuda"
resp
.
Library
=
"cuda"
}
else
{
}
else
{
...
...
llm/generate/gen_common.sh
View file @
e02ecfb6
...
@@ -39,6 +39,9 @@ init_vars() {
...
@@ -39,6 +39,9 @@ init_vars() {
*
)
*
)
;;
;;
esac
esac
if
[
-z
"
${
CMAKE_CUDA_ARCHITECTURES
}
"
]
;
then
CMAKE_CUDA_ARCHITECTURES
=
"50;52;61;70;75;80"
fi
}
}
git_module_setup
()
{
git_module_setup
()
{
...
...
llm/generate/gen_linux.sh
View file @
e02ecfb6
...
@@ -135,7 +135,7 @@ if [ -d "${CUDA_LIB_DIR}" ]; then
...
@@ -135,7 +135,7 @@ if [ -d "${CUDA_LIB_DIR}" ]; then
if
[
-n
"
${
CUDA_MAJOR
}
"
]
;
then
if
[
-n
"
${
CUDA_MAJOR
}
"
]
;
then
CUDA_VARIANT
=
_v
${
CUDA_MAJOR
}
CUDA_VARIANT
=
_v
${
CUDA_MAJOR
}
fi
fi
CMAKE_DEFS
=
"-DLLAMA_CUBLAS=on
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"-DLLAMA_CUBLAS=on
-DLLAMA_CUDA_FORCE_MMQ=on -DCMAKE_CUDA_ARCHITECTURES=
${
CMAKE_CUDA_ARCHITECTURES
}
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
"
BUILD_DIR
=
"
${
LLAMACPP_DIR
}
/build/linux/
${
ARCH
}
/cuda
${
CUDA_VARIANT
}
"
BUILD_DIR
=
"
${
LLAMACPP_DIR
}
/build/linux/
${
ARCH
}
/cuda
${
CUDA_VARIANT
}
"
EXTRA_LIBS
=
"-L
${
CUDA_LIB_DIR
}
-lcudart -lcublas -lcublasLt -lcuda"
EXTRA_LIBS
=
"-L
${
CUDA_LIB_DIR
}
-lcudart -lcublas -lcublasLt -lcuda"
build
build
...
...
llm/generate/gen_windows.ps1
View file @
e02ecfb6
...
@@ -25,6 +25,11 @@ function init_vars {
...
@@ -25,6 +25,11 @@ function init_vars {
}
}
$
script
:
GZIP
=
(
get-command
-ea
'silentlycontinue'
gzip
)
.
path
$
script
:
GZIP
=
(
get-command
-ea
'silentlycontinue'
gzip
)
.
path
$
script
:
DUMPBIN
=
(
get-command
-ea
'silentlycontinue'
dumpbin
)
.
path
$
script
:
DUMPBIN
=
(
get-command
-ea
'silentlycontinue'
dumpbin
)
.
path
if
(
$null
-eq
$
env
:
CMAKE_CUDA_ARCHITECTURES
)
{
$
script
:
CMAKE_CUDA_ARCHITECTURES
=
"50;52;61;70;75;80"
}
else
{
$
script
:
CMAKE_CUDA_ARCHITECTURES
=
$
env
:
CMAKE_CUDA_ARCHITECTURES
}
}
}
function
git_module_setup
{
function
git_module_setup
{
...
@@ -151,7 +156,7 @@ if ($null -ne $script:CUDA_LIB_DIR) {
...
@@ -151,7 +156,7 @@ if ($null -ne $script:CUDA_LIB_DIR) {
}
}
init_vars
init_vars
$
script
:
buildDir
=
"
${script:llamacppDir}
/build/windows/
${script:ARCH}
/cuda
$
script
:
CUDA_VARIANT
"
$
script
:
buildDir
=
"
${script:llamacppDir}
/build/windows/
${script:ARCH}
/cuda
$
script
:
CUDA_VARIANT
"
$
script
:
cmakeDefs
+=
@(
"-DLLAMA_CUBLAS=ON"
,
"-DLLAMA_AVX=on"
)
$
script
:
cmakeDefs
+=
@(
"-DLLAMA_CUBLAS=ON"
,
"-DLLAMA_AVX=on"
,
"-DCMAKE_CUDA_ARCHITECTURES=
${script:CMAKE_CUDA_ARCHITECTURES}
"
)
build
build
install
install
cp
"
${script:CUDA_LIB_DIR}
/cudart64_*.dll"
"
${script:buildDir}
/lib"
cp
"
${script:CUDA_LIB_DIR}
/cudart64_*.dll"
"
${script:buildDir}
/lib"
...
...
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