omp_matinv_racy.vgtest \
omp_prime_racy.stderr.exp \
omp_prime_racy.vgtest \
+ omp_printf.stderr.exp \
+ omp_printf.vgtest \
pth_barrier.stderr.exp \
pth_barrier.vgtest \
pth_barrier2.stderr.exp \
endif
if HAVE_OPENMP
-check_PROGRAMS += omp_matinv omp_prime
+check_PROGRAMS += omp_matinv omp_prime omp_printf
endif
omp_prime_CFLAGS = $(AM_CFLAGS) -fopenmp
omp_prime_LDFLAGS = -fopenmp
omp_prime_LDADD = -lm
+
+omp_printf_SOURCES = omp_printf.c
+omp_printf_CFLAGS = $(AM_CFLAGS) -fopenmp
+omp_printf_LDFLAGS = -fopenmp
+omp_printf_LDADD = -lm
endif
--- /dev/null
+/* Simple OpenMP test program that calls printf() from a parallel section. */
+
+#include <omp.h>
+#include <stdio.h>
+#include <unistd.h> // getopt()
+
+static void usage(const char* const exe)
+{
+ printf("Usage: %s [-h] [-q] [-r] [-t<n>] <m>\n"
+ "-h: display this information.\n"
+ "-q: quiet mode -- do not print computed error.\n",
+ exe);
+}
+
+int main(int argc, char** argv)
+{
+ int i;
+ int optchar;
+ int silent = 0;
+ int tid;
+
+ while ((optchar = getopt(argc, argv, "hq")) != EOF)
+ {
+ switch (optchar)
+ {
+ case 'h': usage(argv[0]); return 1;
+ case 'q': silent = 1; break;
+ default:
+ return 1;
+ }
+ }
+
+#pragma omp parallel private(tid)
+ for (i = 0; i < 2; i++)
+ {
+ tid = omp_get_thread_num();
+ if (! silent)
+ {
+ printf("omp_get_thread_num() = %d/%d\n", tid, omp_get_num_threads());
+ }
+ else
+ {
+ printf("%s", "");
+ }
+ }
+
+ fprintf(stderr, "Finished.\n");
+
+ return 0;
+}
--- /dev/null
+prereq: ./run_openmp_test ./omp_printf
+prog: omp_printf
+vgopts: --check-stack-var=yes --var-info=yes
+args: -q
+stderr_filter: filter_error_summary