changeset 988:e55bb62b2970

improved test programs of packages libgomp and pthreads
author Volker Grabsch <vog@notjusthosting.com>
date Wed, 19 May 2010 23:50:39 +0200
parents 77ef614fd370
children 05c8ebf4681d
files src/libgomp-test.c src/pthreads-test.c
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/libgomp-test.c	Wed May 19 22:35:49 2010 +0200
+++ b/src/libgomp-test.c	Wed May 19 23:50:39 2010 +0200
@@ -9,9 +9,11 @@
     (void)argc;
     (void)argv;
 
+    omp_set_num_threads(4);
+
     #pragma omp parallel
-    printf("Hello from thread %d, nthreads %d\n",
-           omp_get_thread_num(), omp_get_num_threads());
+    fprintf(stderr, "Hello from thread %d, nthreads %d\n",
+            omp_get_thread_num(), omp_get_num_threads());
 
     return 0;
 }
--- a/src/pthreads-test.c	Wed May 19 22:35:49 2010 +0200
+++ b/src/pthreads-test.c	Wed May 19 23:50:39 2010 +0200
@@ -4,12 +4,12 @@
 #include <stdio.h>
 #include <pthread.h>
 
-#define N 10
+#define N 4
 
 void *thread_fn(void *p)
 {
     const int *arg = p;
-    fprintf(stderr, "Hello from thread %d\n", *arg);
+    fprintf(stderr, "Hello from thread %d, nthreads %d\n", *arg, N);
     return NULL;
 }