Skip to content
Snippets Groups Projects
Commit cfc4e388 authored by Siarhei Siamashka's avatar Siarhei Siamashka
Browse files

test: added OpenMP support for better utilization of multiple CPU cores

Some of the tests are quite heavy CPU users and may benefit from
using multiple CPU cores, so the programs from 'test' directory
are now built with OpenMP support. OpenMP is easy to use, portable
and also takes care of making a decision about how many threads
to spawn.
parent f905ebb0
Branches main
No related merge requests found
......@@ -77,6 +77,10 @@ AC_CHECK_FUNCS([getisax])
AC_C_BIGENDIAN
AC_C_INLINE
# Check for OpenMP support (only supported by autoconf >=2.62)
OPENMP_CFLAGS=
m4_ifdef([AC_OPENMP], [AC_OPENMP], [AC_SUBST(OPENMP_CFLAGS)])
AC_CHECK_SIZEOF(long)
# Checks for Sun Studio compilers
......
AM_CFLAGS = @OPENMP_CFLAGS@
AM_LDFLAGS = @OPENMP_CFLAGS@
TEST_LDADD = $(top_builddir)/pixman/libpixman-1.la
INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman
......
......@@ -286,6 +286,8 @@ fuzzer_test_main (const char *test_name,
n2 = default_number_of_iterations;
}
#pragma omp parallel for reduction(+:checksum) default(none) \
shared(n1, n2, test_function, verbose)
for (i = n1; i <= n2; i++)
{
uint32_t crc = test_function (i, 0);
......
......@@ -7,6 +7,7 @@
*/
extern uint32_t lcg_seed;
#pragma omp threadprivate(lcg_seed)
static inline uint32_t
lcg_rand (void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment