Skip to content

Commit f9ba819

Browse files
committed
Disable multiple threads for emscripten single-thread builds in ggml_graph_plan
1 parent 5bcd577 commit f9ba819

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ggml/src/ggml-cpu/ggml-cpu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,11 @@ struct ggml_cplan ggml_graph_plan(
27012701
n_threads = threadpool ? threadpool->n_threads_max : GGML_DEFAULT_N_THREADS;
27022702
}
27032703

2704+
#if defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)
2705+
// Emscripten without pthreads support can only use a single thread
2706+
n_threads = 1;
2707+
#endif
2708+
27042709
size_t work_size = 0;
27052710

27062711
struct ggml_cplan cplan;

0 commit comments

Comments
 (0)