diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2015-07-21 13:30:06 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2015-07-21 13:30:06 +0000 |
commit | 22be23495a1f0cd1ae6a1aca32c39edb9f7a9c51 (patch) | |
tree | 5346a618826d07eaa35796ae94daf5f43300dc8a /libgomp/oacc-init.c | |
parent | c5189d8e679126d652b23761fb95bc5042c19ea9 (diff) | |
download | gcc-22be23495a1f0cd1ae6a1aca32c39edb9f7a9c51.tar.gz |
target.c (gomp_offload_image_to_device): Rename to ...
libgomp/
* target.c (gomp_offload_image_to_device): Rename to ...
(gomp_load_image_to_device): ... here.
(GOMP_offload_register): Adjust call.
(gomp_init_device): Likewise.
(gomp_unload_image_from_device): New. Broken out of ...
(GOMP_offload_unregister): ... here. Call it.
(gomp_unload_device): New.
* libgomp.h (gomp_unload_device): Declare.
* oacc-init.c (acc_shutdown_1): Unload from device before deleting
mem maps.
gcc/
* config/nvptx/mkoffload.c (process): Add static destructor call.
From-SVN: r226039
Diffstat (limited to 'libgomp/oacc-init.c')
-rw-r--r-- | libgomp/oacc-init.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c index c91731edcac..105d9dc45de 100644 --- a/libgomp/oacc-init.c +++ b/libgomp/oacc-init.c @@ -252,6 +252,18 @@ acc_shutdown_1 (acc_device_t d) /* Get the base device for this device type. */ base_dev = resolve_device (d, true); + ndevs = base_dev->get_num_devices_func (); + + /* Unload all the devices of this type that have been opened. */ + for (i = 0; i < ndevs; i++) + { + struct gomp_device_descr *acc_dev = &base_dev[i]; + + gomp_mutex_lock (&acc_dev->lock); + gomp_unload_device (acc_dev); + gomp_mutex_unlock (&acc_dev->lock); + } + gomp_mutex_lock (&goacc_thread_lock); /* Free target-specific TLS data and close all devices. */ @@ -290,7 +302,6 @@ acc_shutdown_1 (acc_device_t d) gomp_mutex_unlock (&goacc_thread_lock); - ndevs = base_dev->get_num_devices_func (); /* Close all the devices of this type that have been opened. */ for (i = 0; i < ndevs; i++) |