Felipe97/llama-cpp-compiled
01.1k
1// ref: https://github.com/ggml-org/llama.cpp/issues/4952#issuecomment-18928647632 3#include <thread>4 5#include "llama.h"6#include "common.h"7 8// This creates a new context inside a pthread and then tries to exit cleanly.9int main(int argc, char ** argv) {10 auto * model_path = common_get_model_or_exit(argc, argv);11 12 std::thread([&model_path]() {13 llama_backend_init();14 auto * model = llama_model_load_from_file(model_path, llama_model_default_params());15 auto * ctx = llama_init_from_model(model, llama_context_default_params());16 llama_free(ctx);17 llama_model_free(model);18 llama_backend_free();19 }).join();20 21 return 0;22}23 