forked from nnstreamer/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llamacpp] Add .mk files for ndk-build support of llama.cpp
This patch adds mk files for ndk-build of llama.cpp. Signed-off-by: Yelin Jeong <[email protected]>
- Loading branch information
1 parent
48ca203
commit eba2cbe
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
java/android/nnstreamer/src/main/jni/Android-llamacpp-prebuilt.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#------------------------------------------------------ | ||
# llama.cpp : Inference of Meta's LLaMA model (and others) in pure C/C++ | ||
# https://github.com/ggerganov/llama.cpp (original upstream repository | ||
# | ||
# This mk file defines a prebuilt shared library for the llamacpp module. | ||
#------------------------------------------------------ | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
|
||
ifndef LLAMACPP_LIB_PATH | ||
$(error LLAMACPP_LIB_PATH is not defined!) | ||
endif | ||
|
||
# Check Target ABI. Only supports arm64 and x86_64. | ||
ifeq ($(TARGET_ARCH_ABI),arm64-v8a) | ||
LLAMACPP_LIB_PATH := $(LLAMACPP_LIB_PATH)/arm64 | ||
else ifeq ($(TARGET_ARCH_ABI),x86_64) | ||
LLAMACPP_LIB_PATH := $(LLAMACPP_LIB_PATH)/x86_64 | ||
else | ||
$(error Target arch ABI not supported: $(TARGET_ARCH_ABI)) | ||
endif | ||
|
||
LLAMACPP_PREBUILT_LIBS := | ||
|
||
#------------------------------------------------------ | ||
# llamacpp prebuilt shared libraries | ||
#------------------------------------------------------ | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := llama | ||
LOCAL_SRC_FILES := $(LLAMACPP_LIB_PATH)/libllama.so | ||
include $(PREBUILT_SHARED_LIBRARY) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := ggml | ||
LOCAL_SRC_FILES := $(LLAMACPP_LIB_PATH)/libggml.so | ||
include $(PREBUILT_SHARED_LIBRARY) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := ggml-cpu | ||
LOCAL_SRC_FILES := $(LLAMACPP_LIB_PATH)/libggml-cpu.so | ||
include $(PREBUILT_SHARED_LIBRARY) | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := ggml-base | ||
LOCAL_SRC_FILES := $(LLAMACPP_LIB_PATH)/libggml-base.so | ||
include $(PREBUILT_SHARED_LIBRARY) | ||
LLAMACPP_PREBUILT_LIBS += llama ggml ggml-cpu ggml-base | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
LLAMACPP_DIR := $(LOCAL_PATH)/llamacpp | ||
LLAMACPP_INCLUDES := $(LLAMACPP_DIR)/include | ||
LLAMACPP_LIB_PATH := $(LLAMACPP_DIR)/lib | ||
|
||
#------------------------------------------------------ | ||
# Import LLAMACPP_PREBUILT_LIBS | ||
#------------------------------------------------------ | ||
include $(LOCAL_PATH)/Android-llamacpp-prebuilt.mk | ||
|
||
#------------------------------------------------------ | ||
# tensor-filter sub-plugin for llamacpp | ||
#------------------------------------------------------ | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := llamacpp-subplugin | ||
LOCAL_SRC_FILES := $(NNSTREAMER_FILTER_LLAMACPP_SRCS) | ||
LOCAL_CXXFLAGS := -O3 -fPIC -frtti -fexceptions $(NNS_API_FLAGS) | ||
LOCAL_C_INCLUDES := $(LLAMACPP_INCLUDES) $(NNSTREAMER_INCLUDES) $(GST_HEADERS_COMMON) | ||
LOCAL_SHARED_LIBRARIES := $(LLAMACPP_PREBUILT_LIBS) | ||
LOCAL_STATIC_LIBRARIES := nnstreamer | ||
|
||
include $(BUILD_STATIC_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters