ggml : add option to not print stack on abort (ggml/1081)

* Add option to not print stack on abort

Add option/envvar to disable stack printing on abort.
Also link some unittests with Threads to fix link errors on
ubuntu/g++11.

* Update ggml/src/ggml.c

---------

Co-authored-by: Diego Devesa <slarengh@gmail.com>
This commit is contained in:
William Tambellini 2025-01-23 11:59:08 -08:00 committed by Georgi Gerganov
parent d2e518e9b4
commit 1a0e87d291
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -128,6 +128,10 @@ static void ggml_print_backtrace_symbols(void) {
#endif #endif
static void ggml_print_backtrace(void) { static void ggml_print_backtrace(void) {
const char * GGML_NO_BACKTRACE = getenv("GGML_NO_BACKTRACE");
if (GGML_NO_BACKTRACE) {
return;
}
char attach[32]; char attach[32];
snprintf(attach, sizeof(attach), "attach %d", getpid()); snprintf(attach, sizeof(attach), "attach %d", getpid());
int pid = fork(); int pid = fork();