Skip to content

Commit

Permalink
llama-bench : only show progress messages when verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Sep 4, 2024
1 parent 575fb63 commit 02ac357
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions examples/llama-bench/llama-bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,9 +1517,12 @@ int main(int argc, char ** argv) {
const cmd_params_instance * prev_inst = nullptr;

int params_idx = 0;
auto params_count = params_instances.size();
for (const auto & inst : params_instances) {
params_idx ++;
LOG_TEE("llama-bench: benchmark %d/%ld: starting\n", params_idx, params_instances.size());
if (params.verbose) {
LOG_TEE("llama-bench: benchmark %d/%ld: starting\n", params_idx, params_count);
}
// keep the same model between tests when possible
if (!lmodel || !prev_inst || !inst.equal_mparams(*prev_inst)) {
if (lmodel) {
Expand Down Expand Up @@ -1569,12 +1572,16 @@ int main(int argc, char ** argv) {

// warmup run
if (t.n_prompt > 0) {
LOG_TEE("llama-bench: benchmark %d/%ld: warmup prompt run\n", params_idx, params_instances.size());
if (params.verbose) {
LOG_TEE("llama-bench: benchmark %d/%ld: warmup prompt run\n", params_idx, params_count);
}
//test_prompt(ctx, std::min(t.n_batch, std::min(t.n_prompt, 32)), 0, t.n_batch, t.n_threads);
test_prompt(ctx, t.n_prompt, 0, t.n_batch, t.n_threads);
}
if (t.n_gen > 0) {
LOG_TEE("llama-bench: benchmark %d/%ld: warmup generation run\n", params_idx, params_instances.size());
if (params.verbose) {
LOG_TEE("llama-bench: benchmark %d/%ld: warmup generation run\n", params_idx, params_count);
}
test_gen(ctx, 1, 0, t.n_threads);
}

Expand All @@ -1584,11 +1591,15 @@ int main(int argc, char ** argv) {
uint64_t t_start = get_time_ns();

if (t.n_prompt > 0) {
LOG_TEE("llama-bench: benchmark %d/%ld: prompt run %d/%d\n", params_idx, params_instances.size(), i + 1, params.reps);
if (params.verbose) {
LOG_TEE("llama-bench: benchmark %d/%ld: prompt run %d/%d\n", params_idx, params_count, i + 1, params.reps);
}
test_prompt(ctx, t.n_prompt, 0, t.n_batch, t.n_threads);
}
if (t.n_gen > 0) {
LOG_TEE("llama-bench: benchmark %d/%ld: generation run %d/%d\n", params_idx, params_instances.size(), i + 1, params.reps);
if (params.verbose) {
LOG_TEE("llama-bench: benchmark %d/%ld: generation run %d/%d\n", params_idx, params_count, i + 1, params.reps);
}
test_gen(ctx, t.n_gen, t.n_prompt, t.n_threads);
}

Expand Down

0 comments on commit 02ac357

Please sign in to comment.