Skip to content

Commit dc20e8c

Browse files
committed
fix: Copy dependencies for windows
fix: :( fix fix fix: Copy runtime dlls on windows fix: Add explicit copy command for windows dlls fix fix fix: >:( fix fix fix fix Update path on windows check dll dependancies fix: Update PATH on win32 ci: Update test.yaml
1 parent 73fe013 commit dc20e8c

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,6 @@ jobs:
8181
run: |
8282
python -m pytest
8383
84-
# build-linux-opencl:
85-
86-
# runs-on: ubuntu-latest
87-
88-
# steps:
89-
# - uses: actions/checkout@v4
90-
# with:
91-
# submodules: "recursive"
92-
# - name: Set up Python 3.8
93-
# uses: actions/setup-python@v5
94-
# with:
95-
# python-version: "3.8"
96-
# - name: Set up OpenCL & CLBlast
97-
# run: |
98-
# wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
99-
# echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
100-
# sudo apt-get update
101-
# sudo apt-get install -y --no-install-recommends llvm intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers libclblast-dev
102-
# - name: Install dependencies
103-
# run: |
104-
# python -m pip install --upgrade pip
105-
# CMAKE_ARGS="-DLLAMA_CLBLAST=on" python -m pip install .[all] --verbose
106-
# - name: Test with pytest
107-
# run: |
108-
# python -m pytest
109-
11084
11185
build-macos-metal:
11286

CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,24 @@ if (LLAMA_BUILD)
7272
add_subdirectory(vendor/llama.cpp)
7373
llama_cpp_python_install_target(llama)
7474
llama_cpp_python_install_target(ggml)
75+
7576
# Workaround for Windows + CUDA https://github.com/abetlen/llama-cpp-python/issues/563
76-
if (WIN32 AND (LLAMA_CUDA OR LLAMA_CUBLAS))
77+
if (WIN32)
7778
install(
7879
FILES $<TARGET_RUNTIME_DLLS:llama>
79-
DESTINATION ${LLAMA_CPP_PYTHON_INSTALL_DIR}
80+
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib
81+
)
82+
install(
83+
FILES $<TARGET_RUNTIME_DLLS:llama>
84+
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib
85+
)
86+
install(
87+
FILES $<TARGET_RUNTIME_DLLS:ggml>
88+
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib
89+
)
90+
install(
91+
FILES $<TARGET_RUNTIME_DLLS:ggml>
92+
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib
8093
)
8194
endif()
8295

@@ -98,5 +111,15 @@ if (LLAMA_BUILD)
98111
set_target_properties(llava_shared PROPERTIES CUDA_ARCHITECTURES OFF)
99112
endif()
100113
llama_cpp_python_install_target(llava_shared)
114+
if (WIN32)
115+
install(
116+
FILES $<TARGET_RUNTIME_DLLS:llava_shared>
117+
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp/lib
118+
)
119+
install(
120+
FILES $<TARGET_RUNTIME_DLLS:llava_shared>
121+
DESTINATION ${SKBUILD_PLATLIB_DIR}/llama_cpp/lib
122+
)
123+
endif()
101124
endif()
102-
endif()
125+
endif()

llama_cpp/llama_cpp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ def _load_shared_library(lib_base_name: str):
5252
_lib_paths = [_lib.resolve()]
5353

5454
cdll_args = dict() # type: ignore
55+
5556
# Add the library directory to the DLL search path on Windows (if needed)
57+
if sys.platform == "win32":
58+
os.add_dll_directory(str(_base_path))
59+
os.environ['PATH'] = str(_base_path) + os.pathsep + os.environ['PATH']
60+
5661
if sys.platform == "win32" and sys.version_info >= (3, 8):
5762
os.add_dll_directory(str(_base_path))
5863
if "CUDA_PATH" in os.environ:

0 commit comments

Comments
 (0)