Commit 6222a7a0 authored by Alexandre Julliard's avatar Alexandre Julliard

vcomp/tests: Limit the number of nested threads.

Without a limit we'd create nb_cpus ^ 2 threads.
parent 3e3caf1e
...@@ -406,6 +406,10 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads, ...@@ -406,6 +406,10 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads,
is_parallel = pomp_in_parallel(); is_parallel = pomp_in_parallel();
ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel); ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel);
/* limit number of nested threads */
nested_threads = min( nested_threads, 256 / pomp_get_max_threads() );
p_vcomp_set_num_threads(nested_threads);
thread_count = 0; thread_count = 0;
p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count); p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count);
if (nested) if (nested)
...@@ -422,17 +426,6 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads, ...@@ -422,17 +426,6 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads,
is_parallel = pomp_in_parallel(); is_parallel = pomp_in_parallel();
ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel); ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel);
p_vcomp_set_num_threads(4);
thread_count = 0;
p_vcomp_fork(TRUE, 2, num_threads_cb2, TRUE, &thread_count);
if (nested)
ok(thread_count == 4, "expected 4 threads, got %ld\n", thread_count);
else
ok(thread_count == 1, "expected 1 thread, got %ld\n", thread_count);
is_parallel = pomp_in_parallel();
ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel);
} }
static void test_omp_get_num_threads(BOOL nested) static void test_omp_get_num_threads(BOOL nested)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment