This commit is contained in:
sasha0552 2024-06-25 17:58:57 +00:00 committed by GitHub
parent 450eafc7b8
commit a7e1725e8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View file

@ -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 unicode.o unicode-data.o OBJS += ggml-alloc.o ggml-backend.o ggml-quants.o nvapi.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,13 +794,16 @@ 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 unicode.h ggml.h ggml-alloc.h ggml-backend.h ggml-cuda.h ggml-metal.h llama.h llama.o: llama.cpp nvapi.h 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)

View file

@ -1,5 +1,8 @@
#include "nvapi.h" #include "nvapi.h"
// TODO: remove
#include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
#include <libloaderapi.h> #include <libloaderapi.h>
#elif __linux__ #elif __linux__
@ -84,7 +87,7 @@ void nvapi_free() {
if (lib) { if (lib) {
FreeLibrary(lib); FreeLibrary(lib);
} }
#else #elif __linux__
if (lib) { if (lib) {
dlclose(lib); dlclose(lib);
} }
@ -101,6 +104,7 @@ void nvapi_set_pstate(int ids[], int ids_size, int pstate) {
} }
// TODO // TODO
printf("nvapi_set_pstate: %d", pstate);
} }
void nvapi_set_pstate_high() { void nvapi_set_pstate_high() {

View file

@ -7,6 +7,10 @@ extern "C" {
void nvapi_init(); void nvapi_init();
void nvapi_free(); void nvapi_free();
void nvapi_set_pstate(int ids[], int ids_size, int pstate);
void nvapi_set_pstate_high();
void nvapi_set_pstate_low();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif