-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JNI/Android: Add .mk files for ndk-build support of llama2.c
This patch adds the .mk scripts to enable ndk-build support for llama2.c. Signed-off-by: Wook Song <wook16.song@samsung.com>
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
java/android/nnstreamer/src/main/jni/Android-llama2c-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,30 @@ | ||
#------------------------------------------------------ | ||
# Llama2.c: Inference Llama 2 in one file of pure C | ||
# https://github.com/karpathy/llama2.c (original upstream repository) | ||
# https://github.com/nnsuite/llama2.c (NNSuite forked repository) | ||
# | ||
# This mk file defines a prebuilt shared library for the llama2.c module. | ||
#------------------------------------------------------ | ||
LOCAL_PATH := $(call my-dir) | ||
|
||
ifndef LLAMA2C_DIR | ||
$(error LLAMA2C_DIR is not defined!) | ||
endif | ||
|
||
LLAMA2C_LIB_PATH := $(LLAMA2C_DIR)/lib | ||
|
||
#------------------------------------------------------ | ||
# The prebuilt shared library for llama2.c | ||
#------------------------------------------------------ | ||
LLAMA2C_PREBUILT_LIBS := | ||
|
||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := llama2c | ||
LOCAL_SRC_FILES := \ | ||
$(LLAMA2C_DIR)/api.c \ | ||
$(LLAMA2C_DIR)/sampler.c \ | ||
$(LLAMA2C_DIR)/tokenizer.c \ | ||
$(LLAMA2C_DIR)/transformer.c \ | ||
$(LLAMA2C_DIR)/util.c | ||
include $(BUILD_SHARED_LIBRARY) | ||
LLAMA2C_PREBUILT_LIBS += llama2c |
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) | ||
|
||
LLAMA2C_DIR := $(LOCAL_PATH)/llama2.c | ||
LLAMA2C_INCLUDES := $(LLAMA2C_DIR)/include | ||
LLAMA2C_LIB_PATH := $(LLAMA2C_DIR)/lib | ||
|
||
#------------------------------------------------------ | ||
# Import LLAMA2C_PREBUILT_LIBS | ||
#------------------------------------------------------ | ||
include $(LOCAL_PATH)/Android-llama2c-prebuilt.mk | ||
|
||
#------------------------------------------------------ | ||
# tensor-filter sub-plugin for llama2.c | ||
#------------------------------------------------------ | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := llama2c-subplugin | ||
LOCAL_SRC_FILES := $(NNSTREAMER_FILTER_LLAMA2C_SRCS) | ||
LOCAL_CXXFLAGS := -O3 -fPIC -frtti -fexceptions $(NNS_API_FLAGS) | ||
LOCAL_C_INCLUDES := $(LLAMA2C_INCLUDES) $(NNSTREAMER_INCLUDES) $(GST_HEADERS_COMMON) | ||
LOCAL_STATIC_LIBRARIES := nnstreamer | ||
LOCAL_SHARED_LIBRARIES := $(LLAMA2C_PREBUILT_LIBS) | ||
|
||
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