File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -296,7 +296,17 @@ struct gpt_log * gpt_log_init() {
296
296
}
297
297
298
298
struct gpt_log * gpt_log_main () {
299
- static struct gpt_log * log = gpt_log_init ();
299
+ // this is supposed to be thread-safe but sanitizer complains
300
+ // https://github.com/ggerganov/llama.cpp/actions/runs/10815973423/job/30006101803?pr=9418#step:6:3731
301
+ // static struct gpt_log * log = gpt_log_init();
302
+
303
+ // let's try this instead
304
+ static struct gpt_log * log = nullptr ;
305
+ static std::once_flag flag;
306
+ std::call_once (flag, []() {
307
+ log = gpt_log_init ();
308
+ });
309
+
300
310
return log;
301
311
}
302
312
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ int main() {
9
9
10
10
std::thread threads[n_thread];
11
11
for (int i = 0 ; i < n_thread; i++) {
12
- threads[i] = std::thread ([i]() {
12
+ threads[i] = std::thread ([i, n_msg ]() {
13
13
for (int j = 0 ; j < n_msg; j++) {
14
14
const int log_type = std::rand () % 4 ;
15
15
You can’t perform that action at this time.
0 commit comments