Skip to content

Commit 9106232

Browse files
committed
threading test: At github, Windows can take more than 20 seconds to start 15 threads.Let's silently ignore when we saw two adjacent slowness.
1 parent 48016f6 commit 9106232

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/test-ggml-threading.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,19 @@ int main(void) {
217217
int workload_arr_len = sizeof(workload_arr) / sizeof(workload_arr[0]);
218218

219219
// skip slow/big n_threads.
220+
221+
int n_slow = 0;
222+
220223
for (int i = 0; i < threads_arr_len; i++) {
221224
int n_threads = threads_arr[i];
222225

226+
// At github, Windows can take more than 20 seconds to start 15 threads.
227+
// Let's silently ignore when we saw two adjacent slowness.
228+
if (n_slow >= 2) {
229+
threads_arr[i] = 0;
230+
continue;
231+
}
232+
223233
if (n_threads == 1) {
224234
continue;
225235
} else if (n_threads > MAX_N_THREADS) {
@@ -243,10 +253,14 @@ int main(void) {
243253

244254
int elapsed_us = t1 - t0;
245255
if (elapsed_us > 500 * n_threads) {
246-
printf("[test-ggml-threading] warning: it took took %.3f "
247-
"ms to start %d worker thread(s). Loo slow, skip.\n",
256+
printf("[test-ggml-threading] warning: it took took %7.3f "
257+
"ms to start %2d worker thread(s). Too slow, skip.\n",
248258
1.0 * elapsed_us / 1000, n_threads - 1);
249259
threads_arr[i] = 0;
260+
++n_slow;
261+
} else {
262+
// clear.
263+
n_slow = 0;
250264
}
251265
}
252266

0 commit comments

Comments
 (0)