diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-23 06:06:29 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-23 06:06:29 +0000 |
commit | 8a096472683581315df6e6747212356b3255087e (patch) | |
tree | dac105eba22e3c3a544b760bd2ca5b1db944f65e /libgomp | |
parent | 63217c8a41fa03e943e9859df194ab78cbe8639b (diff) | |
download | gcc-8a096472683581315df6e6747212356b3255087e.tar.gz |
2008-06-23 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r137030
* gcc/melt/warm-basilys.bysl: some primitives got explicit casts.
* gcc/basilys.h: added casts to avoid implicit conversion from void*
disallowed with C++
* gcc/basilys.c: (delete_special, forwarded, scanning) likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@137031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 20 | ||||
-rw-r--r-- | libgomp/env.c | 6 | ||||
-rw-r--r-- | libgomp/libgomp.texi | 2 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/task-7.C | 18 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/nqueens-1.c | 66 |
5 files changed, 107 insertions, 5 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 1e81a55d66b..ed27454354e 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,23 @@ +2008-06-19 Jakub Jelinek <jakub@redhat.com> + + * testsuite/libgomp.c/nqueens-1.c: New test. + + PR c++/36523 + * testsuite/libgomp.c++/task-7.C: New function. + +2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * configure: Regenerate. + +2008-06-15 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * env.c (initialize_env): Always initialize gomp_remaining_threads_lock + mutex when HAVE_SYNC_BUILTINS isn't defined. + +2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * libgomp.texi (omp_test_lock): Fix typo. + 2008-06-12 Tobias Burnus <burnus@net-b.de> * omp_lib.f90.in: Add "implicit none". diff --git a/libgomp/env.c b/libgomp/env.c index 50872c277fe..b1349c8e69a 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -487,12 +487,10 @@ initialize_env (void) parse_unsigned_long ("OMP_MAX_ACTIVE_LEVELS", &gomp_max_active_levels_var); parse_unsigned_long ("OMP_THREAD_LIMIT", &gomp_thread_limit_var); if (gomp_thread_limit_var != ULONG_MAX) - { - gomp_remaining_threads_count = gomp_thread_limit_var - 1; + gomp_remaining_threads_count = gomp_thread_limit_var - 1; #ifndef HAVE_SYNC_BUILTINS - gomp_mutex_init (&gomp_remaining_threads_lock); + gomp_mutex_init (&gomp_remaining_threads_lock); #endif - } gomp_init_num_threads (); gomp_available_cpus = gomp_global_icv.nthreads_var; if (!parse_unsigned_long ("OMP_NUM_THREADS", &gomp_global_icv.nthreads_var)) diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index f92a5da77fd..6794ebe9335 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -512,7 +512,7 @@ a deadlock occurs. Before setting a simple lock, the lock variable must be initialized by @code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock} does not block if the lock is not available. This function returns -@code{true} upon success,@code{false} otherwise. Here, @code{true} and +@code{true} upon success, @code{false} otherwise. Here, @code{true} and @code{false} represent their language-specific counterparts. @item @emph{C/C++}: diff --git a/libgomp/testsuite/libgomp.c++/task-7.C b/libgomp/testsuite/libgomp.c++/task-7.C new file mode 100644 index 00000000000..e9828cd2c4d --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/task-7.C @@ -0,0 +1,18 @@ +// PR c++/36523 +// { dg-do run } + +template<typename T> +struct A +{ + A() { } + A(const A&) { } + void foo() { } +}; + +int main() +{ + A<int> a; + #pragma omp task firstprivate (a) + a.foo(); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/nqueens-1.c b/libgomp/testsuite/libgomp.c/nqueens-1.c new file mode 100644 index 00000000000..1fdc67b2963 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/nqueens-1.c @@ -0,0 +1,66 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ +/* { dg-require-effective-target tls_runtime } */ + +#include <omp.h> +#include <stdio.h> +#include <string.h> + +int cnt; +#pragma omp threadprivate (cnt) + +void +nqueens (char *a, int n, int pos) +{ + /* b[i] = j means the queen in i-th row is in column j. */ + char b[pos + 1]; + int i, j; + memcpy (b, a, pos); + for (i = 0; i < n; i++) + { + for (j = 0; j < pos; j++) + if (b[j] == i || b[j] == i + pos - j || i == b[j] + pos - j) + break; + if (j < pos) + continue; + if (pos == n - 1) + /* Found a solution. Could output it here. */ + ++cnt; + else + { + b[pos] = i; + #pragma omp task + nqueens (b, n, pos + 1); + } + } +} + +int +main (int argc, char **argv) +{ + int n = 8; + if (argc >= 2) + n = strtoul (argv[1], NULL, 0); + if (n < 1 || n > 127) + { + fprintf (stderr, "invalid count %d\n", n); + return 1; + } + cnt = 0; + double stime = omp_get_wtime (); + nqueens ("", n, 0); + printf ("serial N %d solutions # %d time %f\n", n, cnt, omp_get_wtime () - stime); + #pragma omp parallel + cnt = 0; + stime = omp_get_wtime (); + int tempcnt = 0; + #pragma omp parallel reduction (+:tempcnt) + { + #pragma omp single + nqueens ("", n, 0); + tempcnt = cnt; + } + cnt = tempcnt; + printf ("parallel N %d solutions # %d time %f\n", n, cnt, omp_get_wtime () - stime); + return 0; +} |