make shared library containing nvapi
This commit is contained in:
parent
89f764555e
commit
b4b2d961a3
3 changed files with 16 additions and 9 deletions
|
@ -872,6 +872,18 @@ if (LLAMA_CPU_HBM)
|
||||||
target_link_libraries(ggml PUBLIC memkind)
|
target_link_libraries(ggml PUBLIC memkind)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (LLAMA_CUDA)
|
||||||
|
if (LLAMA_NVAPI)
|
||||||
|
add_library(nvapi nvapi.cpp nvapi.h)
|
||||||
|
|
||||||
|
if (LINUX)
|
||||||
|
target_link_libraries(nvapi PUBLIC dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} nvapi)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
function(get_flags CCID CCVER)
|
function(get_flags CCID CCVER)
|
||||||
set(C_FLAGS "")
|
set(C_FLAGS "")
|
||||||
set(CXX_FLAGS "")
|
set(CXX_FLAGS "")
|
||||||
|
@ -1294,8 +1306,6 @@ endif()
|
||||||
add_library(llama
|
add_library(llama
|
||||||
llama.cpp
|
llama.cpp
|
||||||
llama.h
|
llama.h
|
||||||
nvapi.cpp
|
|
||||||
nvapi.h
|
|
||||||
unicode.h
|
unicode.h
|
||||||
unicode.cpp
|
unicode.cpp
|
||||||
unicode-data.cpp
|
unicode-data.cpp
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -698,7 +698,7 @@ ggml-metal-embed.o: ggml-metal.metal ggml-common.h
|
||||||
endif
|
endif
|
||||||
endif # LLAMA_METAL
|
endif # LLAMA_METAL
|
||||||
|
|
||||||
OBJS += ggml-alloc.o ggml-backend.o ggml-quants.o nvapi.o unicode.o unicode-data.o
|
OBJS += ggml-alloc.o ggml-backend.o ggml-quants.o unicode.o unicode-data.o
|
||||||
COMMON_H_DEPS = common/common.h common/sampling.h common/log.h llama.h
|
COMMON_H_DEPS = common/common.h common/sampling.h common/log.h llama.h
|
||||||
COMMON_DEPS = common.o sampling.o grammar-parser.o build-info.o json-schema-to-grammar.o
|
COMMON_DEPS = common.o sampling.o grammar-parser.o build-info.o json-schema-to-grammar.o
|
||||||
|
|
||||||
|
@ -794,16 +794,13 @@ ggml-quants.o: ggml-quants.c ggml.h ggml-quants.h ggml-common.h
|
||||||
ggml-blas.o: ggml-blas.cpp ggml-blas.h
|
ggml-blas.o: ggml-blas.cpp ggml-blas.h
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
nvapi.o: nvapi.cpp nvapi.h
|
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
unicode.o: unicode.cpp unicode.h
|
unicode.o: unicode.cpp unicode.h
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
unicode-data.o: unicode-data.cpp unicode-data.h
|
unicode-data.o: unicode-data.cpp unicode-data.h
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
llama.o: llama.cpp nvapi.h unicode.h ggml.h ggml-alloc.h ggml-backend.h ggml-cuda.h ggml-metal.h llama.h
|
llama.o: llama.cpp unicode.h ggml.h ggml-alloc.h ggml-backend.h ggml-cuda.h ggml-metal.h llama.h
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
common.o: common/common.cpp $(COMMON_H_DEPS)
|
common.o: common/common.cpp $(COMMON_H_DEPS)
|
||||||
|
|
|
@ -16492,7 +16492,7 @@ void llama_backend_init(void) {
|
||||||
ggml_free(ctx);
|
ggml_free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GGML_USE_CUDA
|
#if defined(GGML_USE_CUDA) && defined(LLAMA_NVAPI)
|
||||||
// initalize NvAPI library
|
// initalize NvAPI library
|
||||||
nvapi_init();
|
nvapi_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -16507,7 +16507,7 @@ void llama_numa_init(enum ggml_numa_strategy numa) {
|
||||||
void llama_backend_free(void) {
|
void llama_backend_free(void) {
|
||||||
ggml_quantize_free();
|
ggml_quantize_free();
|
||||||
|
|
||||||
#ifdef GGML_USE_CUDA
|
#if defined(GGML_USE_CUDA) && defined(LLAMA_NVAPI)
|
||||||
// free NvAPI library
|
// free NvAPI library
|
||||||
nvapi_free();
|
nvapi_free();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue