mirror of
https://github.com/Lizonghang/prima.cpp.git
synced 2025-09-07 23:19:03 +00:00
test
This commit is contained in:
parent
976a4c3534
commit
766ec7862b
4 changed files with 27 additions and 1 deletions
8
Makefile
8
Makefile
|
@ -945,7 +945,8 @@ OBJ_COMMON = \
|
||||||
common/sampling.o \
|
common/sampling.o \
|
||||||
common/train.o \
|
common/train.o \
|
||||||
common/build-info.o \
|
common/build-info.o \
|
||||||
common/json-schema-to-grammar.o
|
common/json-schema-to-grammar.o \
|
||||||
|
common/profiler.o
|
||||||
|
|
||||||
OBJ_ALL = $(OBJ_GGML) $(OBJ_LLAMA) $(OBJ_COMMON)
|
OBJ_ALL = $(OBJ_GGML) $(OBJ_LLAMA) $(OBJ_COMMON)
|
||||||
|
|
||||||
|
@ -1186,6 +1187,11 @@ common/arg.o: \
|
||||||
common/arg.h
|
common/arg.h
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
common/profiler.o: \
|
||||||
|
common/profiler.cpp \
|
||||||
|
common/profiler.h
|
||||||
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
common/log.o: \
|
common/log.o: \
|
||||||
common/log.cpp \
|
common/log.cpp \
|
||||||
common/log.h
|
common/log.h
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "json.hpp"
|
#include "json.hpp"
|
||||||
#include "json-schema-to-grammar.h"
|
#include "json-schema-to-grammar.h"
|
||||||
#include "llama.h"
|
#include "llama.h"
|
||||||
|
#include "profile.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
@ -833,6 +834,10 @@ struct llama_init_result llama_init_from_gpt_params(gpt_params & params) {
|
||||||
model = llama_load_model_from_file(params.model.c_str(), mparams);
|
model = llama_load_model_from_file(params.model.c_str(), mparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// profile devices and determine the best setup
|
||||||
|
uint32_t n_cpu_cores = profiler::get_cpu_core_count();
|
||||||
|
LOG_INF("Number of CPU cores on this device: %i\n", n_cpu_cores);
|
||||||
|
|
||||||
if (model == NULL) {
|
if (model == NULL) {
|
||||||
LOG_ERR("%s: failed to load model '%s'\n", __func__, params.model.c_str());
|
LOG_ERR("%s: failed to load model '%s'\n", __func__, params.model.c_str());
|
||||||
return iparams;
|
return iparams;
|
||||||
|
|
7
common/profiler.cpp
Normal file
7
common/profiler.cpp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include "profiler.h"
|
||||||
|
|
||||||
|
namespace profiler {
|
||||||
|
unsigned int get_cpu_core_count() {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
} // namespace profiler
|
8
common/profiler.h
Normal file
8
common/profiler.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef PROFILER_H
|
||||||
|
#define PROFILER_H
|
||||||
|
|
||||||
|
namespace profiler {
|
||||||
|
unsigned int get_cpu_core_count();
|
||||||
|
} // namespace profiler
|
||||||
|
|
||||||
|
#endif // PROFILER_H
|
Loading…
Add table
Reference in a new issue