[Pixman] [PATCH 4/5] test: Parallize composite.c with OpenMP

Maarten Bosmans mkbosmans at gmail.com
Tue Oct 5 12:27:01 PDT 2010


Why would you use OpenMP at all, just to run the tests in parallel?
I'd imagine that the thread-level parallelism it gives isn't necessary
and the tests can just as well be parallized on process-level. Isn't
it easier to avoid the dependency on OpenMP and just use a clever
Makefile to run multiple tests at the same time?

Maarten


2010/10/5 Søren Sandmann Pedersen <ssp at redhat.com>:
> Each test uses the test number as the random number seed; if it
> didn't, all the threads would run the same tests since they would all
> start from the same seed.
> ---
>  test/composite.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/test/composite.c b/test/composite.c
> index 3a06c09..216046f 100644
> --- a/test/composite.c
> +++ b/test/composite.c
> @@ -891,15 +891,17 @@ main (int argc, char **argv)
>            return -1;
>        }
>     }
> -
> +
> +#ifdef USE_OPENMP
> +#   pragma omp parallel for default(none) shared(result) shared(argv)
> +#endif
>     for (i = 1; i <= N_TESTS; ++i)
>     {
> -       if (!run_test (i))
> +       if (!result && !run_test (i))
>        {
>            printf ("Test %d failed.\n", i);
> -
> +
>            result = i;
> -           break;
>        }
>     }
>
> --
> 1.7.1.1


More information about the Pixman mailing list