Skip to content

Commit a7b8ce2

Browse files
theraininskyslaren
andauthored
llama-bench : fix unexpected global variable initialize sequence issue (ggml-org#11832)
* llama-bench : fix unexpected global variable initialize sequence issue * Update examples/llama-bench/llama-bench.cpp --------- Co-authored-by: Diego Devesa <slarengh@gmail.com>
1 parent 04045bb commit a7b8ce2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/llama-bench/llama-bench.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,8 @@ static std::vector<cmd_params_instance> get_cmd_params_instances(const cmd_param
876876
struct test {
877877
static const std::string build_commit;
878878
static const int build_number;
879-
static const std::string cpu_info;
880-
static const std::string gpu_info;
879+
const std::string cpu_info;
880+
const std::string gpu_info;
881881
std::string model_filename;
882882
std::string model_type;
883883
uint64_t model_size;
@@ -903,7 +903,10 @@ struct test {
903903
std::string test_time;
904904
std::vector<uint64_t> samples_ns;
905905

906-
test(const cmd_params_instance & inst, const llama_model * lmodel, const llama_context * ctx) {
906+
test(const cmd_params_instance & inst, const llama_model * lmodel, const llama_context * ctx) :
907+
cpu_info(get_cpu_info()),
908+
gpu_info(get_gpu_info()) {
909+
907910
model_filename = inst.model;
908911
char buf[128];
909912
llama_model_desc(lmodel, buf, sizeof(buf));
@@ -1058,8 +1061,6 @@ struct test {
10581061

10591062
const std::string test::build_commit = LLAMA_COMMIT;
10601063
const int test::build_number = LLAMA_BUILD_NUMBER;
1061-
const std::string test::cpu_info = get_cpu_info();
1062-
const std::string test::gpu_info = get_gpu_info();
10631064

10641065
struct printer {
10651066
virtual ~printer() {}

0 commit comments

Comments
 (0)