aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2020-03-25 17:57:02 +0100
committerThomas Schwinge <thomas@codesourcery.com>2020-03-25 17:57:02 +0100
commit9ae129017c7fc1fa638d6beedd3802b515ca692b (patch)
tree18519991f68ca4f0facf518094f62b3fb0939591
parent34fdecb2eb442640e3f5ad40320bd5859392c9f7 (diff)
downloadgcc-9ae129017c7fc1fa638d6beedd3802b515ca692b.zip
gcc-9ae129017c7fc1fa638d6beedd3802b515ca692b.tar.gz
gcc-9ae129017c7fc1fa638d6beedd3802b515ca692b.tar.bz2
Fix og9 "Fix hang when running oacc exec with CUDA 9.0 nvprof"
Compared to the original og7 version, and still-good og8 version, the og9 version of this patch did get its code altered in a way so that it no longer resolves the problem it's meant to resolve -- the hang was back. libgomp/ * oacc-init.c (acc_init_1): Move 'acc_init_state' logic to where it belongs.
-rw-r--r--libgomp/ChangeLog.omp5
-rw-r--r--libgomp/oacc-init.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 8895786..75c4591 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-03-25 Thomas Schwinge <thomas@codesourcery.com>
+
+ * oacc-init.c (acc_init_1): Move 'acc_init_state' logic to where
+ it belongs.
+
2019-11-22 Kwok Cheung Yeung <kcy@codesourcery.com>
* testsuite/libgomp.oacc-fortran/lib-16.f90: Fix async-safety issue.
diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c
index beeeb48..765fa2f 100644
--- a/libgomp/oacc-init.c
+++ b/libgomp/oacc-init.c
@@ -231,6 +231,11 @@ acc_dev_num_out_of_range (acc_device_t d, int ord, int ndevs)
static struct gomp_device_descr *
acc_init_1 (acc_device_t d, acc_construct_t parent_construct, int implicit)
{
+ gomp_mutex_lock (&acc_init_state_lock);
+ acc_init_state = initializing;
+ acc_init_thread = pthread_self ();
+ gomp_mutex_unlock (&acc_init_state_lock);
+
bool check_not_nested_p;
if (implicit)
{
@@ -293,11 +298,6 @@ acc_init_1 (acc_device_t d, acc_construct_t parent_construct, int implicit)
struct gomp_device_descr *base_dev, *acc_dev;
int ndevs;
- gomp_mutex_lock (&acc_init_state_lock);
- acc_init_state = initializing;
- acc_init_thread = pthread_self ();
- gomp_mutex_unlock (&acc_init_state_lock);
-
base_dev = resolve_device (d, true);
ndevs = base_dev->get_num_devices_func ();