MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / main

Function main

smallthinker/examples/eval-callback/eval-callback.cpp:145–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145int main(int argc, char ** argv) {
146 callback_data cb_data;
147
148 common_params params;
149
150 if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_COMMON)) {
151 return 1;
152 }
153
154 common_init();
155
156 llama_backend_init();
157 llama_numa_init(params.numa);
158
159 // pass the callback to the backend scheduler
160 // it will be executed for each node during the graph computation
161 params.cb_eval = ggml_debug;
162 params.cb_eval_user_data = &cb_data;
163 params.warmup = false;
164
165 // init
166 common_init_result llama_init = common_init_from_params(params);
167
168 llama_model * model = llama_init.model.get();
169 llama_context * ctx = llama_init.context.get();
170
171 if (model == nullptr || ctx == nullptr) {
172 LOG_ERR("%s : failed to init\n", __func__);
173 return 1;
174 }
175
176 // print system information
177 {
178 LOG_INF("\n");
179 LOG_INF("%s\n", common_params_get_system_info(params).c_str());
180 LOG_INF("\n");
181 }
182
183 bool OK = run(ctx, params);
184 if (!OK) {
185 return 1;
186 }
187
188 LOG("\n");
189 llama_perf_context_print(ctx);
190
191 llama_backend_free();
192
193 return 0;
194}

Callers

nothing calls this directly

Calls 11

common_params_parseFunction · 0.85
common_initFunction · 0.85
llama_numa_initFunction · 0.85
common_init_from_paramsFunction · 0.85
llama_perf_context_printFunction · 0.85
runFunction · 0.70
llama_backend_initFunction · 0.50
llama_backend_freeFunction · 0.50
getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected