improved test programs of packages libgomp and pthreads

This commit is contained in:
Volker Grabsch 2010-05-19 23:50:39 +02:00
parent bc2cfdc051
commit 43ba8ad2f1
2 changed files with 6 additions and 4 deletions

View File

@ -9,9 +9,11 @@ int main(int argc, char *argv[])
(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;
}

View File

@ -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;
}