| 143 | } |
| 144 | |
| 145 | int 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 | } |
nothing calls this directly
no test coverage detected