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
ec1acbb8
Unverified
Commit
ec1acbb8
authored
Apr 26, 2024
by
Daniel Hiltgen
Committed by
GitHub
Apr 26, 2024
Browse files
Merge pull request #3968 from dhiltgen/win_generate
Fine grain control over windows generate steps
parents
8e30eb26
e4859c45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
llm/generate/gen_windows.ps1
llm/generate/gen_windows.ps1
+13
-8
No files found.
llm/generate/gen_windows.ps1
View file @
ec1acbb8
...
...
@@ -44,6 +44,7 @@ function init_vars {
$
script
:
commonCpuDefs
=
@(
"-DCMAKE_POSITION_INDEPENDENT_CODE=on"
)
$
script
:
ARCH
=
"amd64"
# arm not yet supported.
$
script
:
DIST_BASE
=
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\ollama_runners"
md
"
$
script
:
DIST_BASE
"
-ea
0
>
$null
if
(
$
env
:
CGO_CFLAGS
-contains
"-g"
)
{
$
script
:
cmakeDefs
+=
@(
"-DCMAKE_VERBOSE_MAKEFILE=on"
,
"-DLLAMA_SERVER_VERBOSE=on"
,
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
)
$
script
:
config
=
"RelWithDebInfo"
...
...
@@ -181,7 +182,7 @@ function cleanup {
function build_static() {
if (
$null
-eq
${env:OLLAMA_SKIP_
CPU
_GENERATE}
) {
if (
(-not "
${env:OLLAMA_SKIP_
STATIC
_GENERATE}
") -and ((-not "
${env:OLLAMA_CPU_TARGET}
") -or ("
${env:OLLAMA_CPU_TARGET}
" -eq "
static
"))
) {
# GCC build for direct linking into the Go binary
init_vars
# cmake will silently fallback to msvc compilers if mingw isn't in the path, so detect and fail fast
...
...
@@ -213,7 +214,7 @@ function build_static() {
}
function build_cpu() {
if (
$null
-eq
${env:OLLAMA_SKIP_CPU_GENERATE}
) {
if (
(-not "
${env:OLLAMA_SKIP_CPU_GENERATE}
" ) -and ((-not "
${env:OLLAMA_CPU_TARGET}
") -or ("
${env:OLLAMA_CPU_TARGET}
" -eq "
cpu
"))
) {
# remaining llama.cpp builds use MSVC
init_vars
$
script
:
cmakeDefs
=
$
script
:
commonCpuDefs
+ @("
-A
", "
x64
", "
-DLLAMA_AVX
=
off
", "
-DLLAMA_AVX2
=
off
", "
-DLLAMA_AVX512
=
off
", "
-DLLAMA_FMA
=
off
", "
-DLLAMA_F16C
=
off
") +
$
script
:
cmakeDefs
...
...
@@ -229,7 +230,7 @@ function build_cpu() {
}
function build_cpu_avx() {
if (
$null
-eq
${env:OLLAMA_SKIP_CPU_GENERATE}
) {
if (
(-not "
${env:OLLAMA_SKIP_CPU_GENERATE}
" ) -and ((-not "
${env:OLLAMA_CPU_TARGET}
") -or ("
${env:OLLAMA_CPU_TARGET}
" -eq "
cpu_avx
"))
) {
init_vars
$
script
:
cmakeDefs
=
$
script
:
commonCpuDefs
+ @("
-A
", "
x64
", "
-DLLAMA_AVX
=
on
", "
-DLLAMA_AVX2
=
off
", "
-DLLAMA_AVX512
=
off
", "
-DLLAMA_FMA
=
off
", "
-DLLAMA_F16C
=
off
") +
$
script
:
cmakeDefs
$
script
:
buildDir
="
..
/build/windows/
${script:ARCH}
/cpu_avx
"
...
...
@@ -239,12 +240,12 @@ function build_cpu_avx() {
sign
install
} else {
write-host "
Skipping
CPU
generation
step
as
requested
"
write-host "
Skipping
CPU
AVX
generation
step
as
requested
"
}
}
function build_cpu_avx2() {
if (
$null
-eq
${env:OLLAMA_SKIP_CPU_GENERATE}
) {
if (
(-not "
${env:OLLAMA_SKIP_CPU_GENERATE}
" ) -and ((-not "
${env:OLLAMA_CPU_TARGET}
") -or ("
${env:OLLAMA_CPU_TARGET}
" -eq "
cpu_avx2
"))
) {
init_vars
$
script
:
cmakeDefs
=
$
script
:
commonCpuDefs
+ @("
-A
", "
x64
", "
-DLLAMA_AVX
=
on
", "
-DLLAMA_AVX2
=
on
", "
-DLLAMA_AVX512
=
off
", "
-DLLAMA_FMA
=
on
", "
-DLLAMA_F16C
=
on
") +
$
script
:
cmakeDefs
$
script
:
buildDir
="
..
/build/windows/
${script:ARCH}
/cpu_avx2
"
...
...
@@ -254,12 +255,12 @@ function build_cpu_avx2() {
sign
install
} else {
write-host "
Skipping
CPU
generation
step
as
requested
"
write-host "
Skipping
CPU
AVX2
generation
step
as
requested
"
}
}
function build_cuda() {
if (
$null
-ne
$
script
:
CUDA_LIB_DIR
) {
if (
(-not "
${env:OLLAMA_SKIP_CUDA_GENERATE}
") -and ("
${
script:CUDA_LIB_DIR
}
")
) {
# Then build cuda as a dynamically loaded library
$nvcc
= "
$
script
:
CUDA_LIB_DIR
\nvcc.exe
"
$
script
:
CUDA_VERSION
=(get-item (
$nvcc
| split-path | split-path)).Basename
...
...
@@ -283,11 +284,13 @@ function build_cuda() {
cp
"
${script:CUDA_LIB_DIR}
\cudart64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
cp
"
${script:CUDA_LIB_DIR}
\cublas64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
cp
"
${script:CUDA_LIB_DIR}
\cublasLt64_*.dll"
"
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\"
}
else
{
write-host
"Skipping CUDA generation step"
}
}
function
build_rocm
()
{
if
(
$null
-ne
$
env
:
HIP_PATH
)
{
if
(
(
-not
"
${env:OLLAMA_SKIP_ROCM_GENERATE}
"
)
-and
(
"
${
env:HIP_PATH
}
"
)
)
{
$
script
:
ROCM_VERSION
=
(
get-item
$
env
:
HIP_PATH
)
.
Basename
if
(
$null
-ne
$
script
:
ROCM_VERSION
)
{
$
script
:
ROCM_VARIANT
=
"_v"
+
$
script
:
ROCM_VERSION
...
...
@@ -336,6 +339,8 @@ function build_rocm() {
cp "
${env:HIP_PATH}
\bin\rocblas.dll
" "
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\rocm\
"
# amdhip64.dll dependency comes from the driver and must be installed on the host to use AMD GPUs
cp "
${env:HIP_PATH}
\bin\rocblas\library\*
" "
${script:SRC_DIR}
\dist\windows-
${script:ARCH}
\rocm\rocblas\library\
"
} else {
write-host "
Skipping
ROCm
generation
step
"
}
}
...
...
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