tool/ex/tests: consistently free ctx, then model (#18168)
This commit is contained in:
parent
e1f15b454f
commit
147a521636
8 changed files with 48 additions and 19 deletions
|
|
@ -2102,6 +2102,8 @@ int main(int argc, char ** argv) {
|
|||
struct ggml_threadpool_params tpp = ggml_threadpool_params_default(t.n_threads);
|
||||
if (!parse_cpu_mask(t.cpu_mask, tpp.cpumask)) {
|
||||
fprintf(stderr, "%s: failed to parse cpu-mask: %s\n", __func__, t.cpu_mask.c_str());
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
tpp.strict_cpu = t.cpu_strict;
|
||||
|
|
@ -2111,6 +2113,8 @@ int main(int argc, char ** argv) {
|
|||
struct ggml_threadpool * threadpool = ggml_threadpool_new_fn(&tpp);
|
||||
if (!threadpool) {
|
||||
fprintf(stderr, "%s: threadpool create failed : n_threads %d\n", __func__, tpp.n_threads);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -2126,6 +2130,8 @@ int main(int argc, char ** argv) {
|
|||
bool res = test_prompt(ctx, t.n_prompt, t.n_batch, t.n_threads);
|
||||
if (!res) {
|
||||
fprintf(stderr, "%s: error: failed to run prompt warmup\n", __func__);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2136,6 +2142,8 @@ int main(int argc, char ** argv) {
|
|||
bool res = test_gen(ctx, 1, t.n_threads);
|
||||
if (!res) {
|
||||
fprintf(stderr, "%s: error: failed to run gen warmup\n", __func__);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2164,6 +2172,8 @@ int main(int argc, char ** argv) {
|
|||
bool res = test_prompt(ctx, t.n_depth, t.n_batch, t.n_threads);
|
||||
if (!res) {
|
||||
fprintf(stderr, "%s: error: failed to run depth\n", __func__);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -2189,6 +2199,8 @@ int main(int argc, char ** argv) {
|
|||
bool res = test_prompt(ctx, t.n_prompt, t.n_batch, t.n_threads);
|
||||
if (!res) {
|
||||
fprintf(stderr, "%s: error: failed to run prompt\n", __func__);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2200,6 +2212,8 @@ int main(int argc, char ** argv) {
|
|||
bool res = test_gen(ctx, t.n_gen, t.n_threads);
|
||||
if (!res) {
|
||||
fprintf(stderr, "%s: error: failed to run gen\n", __func__);
|
||||
llama_free(ctx);
|
||||
llama_model_free(lmodel);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue