This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Approved offline by Diego. All pretty obvious changes. -eric
Attachment:
gomp.cl
Description: Text document
? autom4te.cache Index: testsuite/libgomp.dg/dg.exp =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/dg.exp,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 dg.exp --- testsuite/libgomp.dg/dg.exp 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/dg.exp 7 Jul 2005 22:42:55 -0000 @@ -2,7 +2,7 @@ load_lib libgomp-dg.exp # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS "" + set DEFAULT_CFLAGS "-fopenmp" } # Initialize dg. Index: testsuite/libgomp.dg/omp_hello.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_hello.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_hello.c --- testsuite/libgomp.dg/omp_hello.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_hello.c 7 Jul 2005 22:42:55 -0000 @@ -1,19 +1,20 @@ /****************************************************************************** -* OpenMP Example - Hello World - C/C++ Version * FILE: omp_hello.c * DESCRIPTION: +* OpenMP Example - Hello World - C/C++ Version * In this simple example, the master thread forks a parallel region. * All threads in the team obtain their unique thread number and print it. * The master thread only prints the total number of threads. Two OpenMP * library routines are used to obtain the number of threads and each * thread's number. -* SOURCE: Blaise Barney 5/99 -* LAST REVISED: +* AUTHOR: Blaise Barney 5/99 +* LAST REVISED: 04/06/05 ******************************************************************************/ - #include <omp.h> +#include <stdio.h> +#include <stdlib.h> -main () { +int main (int argc, char *argv[]) { int nthreads, tid; Index: testsuite/libgomp.dg/omp_matvec.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_matvec.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_matvec.c --- testsuite/libgomp.dg/omp_matvec.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_matvec.c 7 Jul 2005 22:42:55 -0000 @@ -12,6 +12,7 @@ ******************************************************************************/ #include <omp.h> +#include <stdio.h> #define SIZE 10 Index: testsuite/libgomp.dg/omp_orphan.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_orphan.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_orphan.c --- testsuite/libgomp.dg/omp_orphan.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_orphan.c 7 Jul 2005 22:42:55 -0000 @@ -1,15 +1,17 @@ /****************************************************************************** -* OpenMP Example - Parallel region with an orphaned directive - C/C++ Version * FILE: omp_orphan.c * DESCRIPTION: +* OpenMP Example - Parallel region with an orphaned directive - C/C++ Version * This example demonstrates a dot product being performed by an orphaned * loop reduction construct. Scoping of the reduction variable is critical. -* SOURCE: Blaise Barney 5/99 -* LAST REVISED: +* AUTHOR: Blaise Barney 5/99 +* LAST REVISED: 04/06/05 ******************************************************************************/ - #include <omp.h> +#include <stdio.h> +#include <stdlib.h> #define VECLEN 100 + float a[VECLEN], b[VECLEN], sum; float dotprod () @@ -28,9 +30,8 @@ return(sum); } -main () +int main (int argc, char *argv[]) { - int i; for (i=0; i < VECLEN; i++) Index: testsuite/libgomp.dg/omp_reduction.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_reduction.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_reduction.c --- testsuite/libgomp.dg/omp_reduction.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_reduction.c 7 Jul 2005 22:42:55 -0000 @@ -1,19 +1,20 @@ /****************************************************************************** -* OpenMP Example - Combined Parallel Loop Reduction - C/C++ Version * FILE: omp_reduction.c * DESCRIPTION: +* OpenMP Example - Combined Parallel Loop Reduction - C/C++ Version * This example demonstrates a sum reduction within a combined parallel loop * construct. Notice that default data element scoping is assumed - there * are no clauses specifying shared or private variables. OpenMP will * automatically make loop index variables private within team threads, and * global variables shared. -* SOURCE: Blaise Barney 5/99 -* LAST REVISED: +* AUTHOR: Blaise Barney 5/99 +* LAST REVISED: 04/06/05 ******************************************************************************/ - #include <omp.h> +#include <stdio.h> +#include <stdlib.h> -main () { +int main (int argc, char *argv[]) { int i, n; float a[100], b[100], sum; Index: testsuite/libgomp.dg/omp_workshare1.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_workshare1.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_workshare1.c --- testsuite/libgomp.dg/omp_workshare1.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_workshare1.c 7 Jul 2005 22:42:55 -0000 @@ -1,19 +1,20 @@ /****************************************************************************** -* OpenMP Example - Loop Work-sharing - C/C++ Version * FILE: omp_workshare1.c * DESCRIPTION: +* OpenMP Example - Loop Work-sharing - C/C++ Version * In this example, the iterations of a loop are scheduled dynamically * across the team of threads. A thread will perform CHUNK iterations * at a time before being scheduled for the next CHUNK of work. -* SOURCE: Blaise Barney 5/99 -* LAST REVISED: 03/03/2002 +* AUTHOR: Blaise Barney 5/99 +* LAST REVISED: 04/06/05 ******************************************************************************/ - #include <omp.h> +#include <stdio.h> +#include <stdlib.h> #define CHUNKSIZE 10 #define N 100 -main () { +int main (int argc, char *argv[]) { int nthreads, tid, i, chunk; float a[N], b[N], c[N]; @@ -23,21 +24,21 @@ for (i=0; i < N; i++) a[i] = b[i] = i * 1.0; chunk = CHUNKSIZE; -#pragma omp parallel shared(a,b,c,chunk) private(i,nthreads,tid) +#pragma omp parallel shared(a,b,c,nthreads,chunk) private(i,tid) { tid = omp_get_thread_num(); + if (tid == 0) + { + nthreads = omp_get_num_threads(); + printf("Number of threads = %d\n", nthreads); + } + printf("Thread %d starting...\n",tid); #pragma omp for schedule(dynamic,chunk) for (i=0; i < N; i++) { c[i] = a[i] + b[i]; - printf("tid= %d i= %d c[i]= %f\n", tid,i,c[i]); - } - - if (tid == 0) - { - nthreads = omp_get_num_threads(); - printf("Number of threads = %d\n", nthreads); + printf("Thread %d: c[%d]= %f\n",tid,i,c[i]); } } /* end of parallel section */ Index: testsuite/libgomp.dg/omp_workshare2.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_workshare2.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_workshare2.c --- testsuite/libgomp.dg/omp_workshare2.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_workshare2.c 7 Jul 2005 22:42:55 -0000 @@ -1,19 +1,19 @@ /****************************************************************************** -* OpenMP Example - Sections Work-sharing - C/C++ Version * FILE: omp_workshare2.c * DESCRIPTION: -* In this example, the iterations of a loop are split into two different -* sections. Each section will be executed by one thread. Extra threads -* will not participate in the sections code. -* SOURCE: Blaise Barney 5/99 -* LAST REVISED: 03/03/2002 +* OpenMP Example - Sections Work-sharing - C/C++ Version +* In this example, the OpenMP SECTION directive is used to assign +* different array operations to threads that execute a SECTION. Each +* thread receives its own copy of the result array to work with. +* AUTHOR: Blaise Barney 5/99 +* LAST REVISED: 04/06/05 ******************************************************************************/ - #include <omp.h> +#include <stdio.h> +#include <stdlib.h> #define N 50 -main () -{ +int main (int argc, char *argv[]) { int i, nthreads, tid; float a[N], b[N], c[N]; @@ -22,38 +22,42 @@ float a[N], b[N], c[N]; for (i=0; i < N; i++) a[i] = b[i] = i * 1.0; -#pragma omp parallel shared(a,b,c) private(i,tid,nthreads) +#pragma omp parallel shared(a,b,nthreads) private(c,i,tid) { tid = omp_get_thread_num(); + if (tid == 0) + { + nthreads = omp_get_num_threads(); + printf("Number of threads = %d\n", nthreads); + } printf("Thread %d starting...\n",tid); #pragma omp sections nowait { - #pragma omp section - for (i=0; i < N/2; i++) + { + printf("Thread %d doing section 1\n",tid); + for (i=0; i<N; i++) { c[i] = a[i] + b[i]; - printf("tid= %d i= %d c[i]= %f\n",tid,i,c[i]); + printf("Thread %d: c[%d]= %f\n",tid,i,c[i]); + } } #pragma omp section - for (i=N/2; i < N; i++) { - c[i] = a[i] + b[i]; - printf("tid= %d i= %d c[i]= %f\n",tid,i,c[i]); + printf("Thread %d doing section 2\n",tid); + for (i=0; i<N; i++) + { + c[i] = a[i] * b[i]; + printf("Thread %d: c[%d]= %f\n",tid,i,c[i]); + } } } /* end of sections */ - if (tid == 0) - { - nthreads = omp_get_num_threads(); - printf("Number of threads = %d\n", nthreads); - } + printf("Thread %d done.\n",tid); } /* end of parallel section */ } - - Index: testsuite/libgomp.dg/omp_workshare3.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_workshare3.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_workshare3.c --- testsuite/libgomp.dg/omp_workshare3.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_workshare3.c 7 Jul 2005 22:42:55 -0000 @@ -10,6 +10,7 @@ ******************************************************************************/ #include <omp.h> +#include <stdio.h> #define N 50 #define CHUNKSIZE 5 Index: testsuite/libgomp.dg/omp_workshare4.c =================================================================== RCS file: /cvs/gcc/gcc/libgomp/testsuite/libgomp.dg/Attic/omp_workshare4.c,v retrieving revision 1.1.2.1 diff -u -p -w -r1.1.2.1 omp_workshare4.c --- testsuite/libgomp.dg/omp_workshare4.c 13 Jun 2005 22:13:13 -0000 1.1.2.1 +++ testsuite/libgomp.dg/omp_workshare4.c 7 Jul 2005 22:42:55 -0000 @@ -11,6 +11,7 @@ ******************************************************************************/ #include <omp.h> +#include <stdio.h> #define N 50 #define CHUNKSIZE 5
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |