1/* OpenACC Runtime Library: acc_device_host. 2 3 Copyright (C) 2013-2015 Free Software Foundation, Inc. 4 5 Contributed by Mentor Embedded. 6 7 This file is part of the GNU Offloading and Multi Processing Library 8 (libgomp). 9 10 Libgomp is free software; you can redistribute it and/or modify it 11 under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 3, or (at your option) 13 any later version. 14 15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY 16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 more details. 19 20 Under Section 7 of GPL version 3, you are granted additional 21 permissions described in the GCC Runtime Library Exception, version 22 3.1, as published by the Free Software Foundation. 23 24 You should have received a copy of the GNU General Public License and 25 a copy of the GCC Runtime Library Exception along with this program; 26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 27 <http://www.gnu.org/licenses/>. */ 28 29/* This shares much of the implementation of the plugin-host.c "host_nonshm" 30 plugin. */ 31#include "plugin/plugin-host.c" 32 33static struct gomp_device_descr host_dispatch = 34 { 35 .name = "host", 36 .capabilities = (GOMP_OFFLOAD_CAP_OPENACC_200 37 | GOMP_OFFLOAD_CAP_NATIVE_EXEC 38 | GOMP_OFFLOAD_CAP_SHARED_MEM), 39 .target_id = 0, 40 .type = OFFLOAD_TARGET_TYPE_HOST, 41 42 .get_name_func = GOMP_OFFLOAD_get_name, 43 .get_caps_func = GOMP_OFFLOAD_get_caps, 44 .get_type_func = GOMP_OFFLOAD_get_type, 45 .get_num_devices_func = GOMP_OFFLOAD_get_num_devices, 46 .init_device_func = GOMP_OFFLOAD_init_device, 47 .fini_device_func = GOMP_OFFLOAD_fini_device, 48 .load_image_func = GOMP_OFFLOAD_load_image, 49 .unload_image_func = GOMP_OFFLOAD_unload_image, 50 .alloc_func = GOMP_OFFLOAD_alloc, 51 .free_func = GOMP_OFFLOAD_free, 52 .dev2host_func = GOMP_OFFLOAD_dev2host, 53 .host2dev_func = GOMP_OFFLOAD_host2dev, 54 .run_func = GOMP_OFFLOAD_run, 55 56 .is_initialized = false, 57 58 .openacc = { 59 .exec_func = GOMP_OFFLOAD_openacc_parallel, 60 61 .register_async_cleanup_func 62 = GOMP_OFFLOAD_openacc_register_async_cleanup, 63 64 .async_set_async_func = GOMP_OFFLOAD_openacc_async_set_async, 65 .async_test_func = GOMP_OFFLOAD_openacc_async_test, 66 .async_test_all_func = GOMP_OFFLOAD_openacc_async_test_all, 67 .async_wait_func = GOMP_OFFLOAD_openacc_async_wait, 68 .async_wait_async_func = GOMP_OFFLOAD_openacc_async_wait_async, 69 .async_wait_all_func = GOMP_OFFLOAD_openacc_async_wait_all, 70 .async_wait_all_async_func = GOMP_OFFLOAD_openacc_async_wait_all_async, 71 72 .create_thread_data_func = GOMP_OFFLOAD_openacc_create_thread_data, 73 .destroy_thread_data_func = GOMP_OFFLOAD_openacc_destroy_thread_data, 74 75 .cuda = { 76 .get_current_device_func = NULL, 77 .get_current_context_func = NULL, 78 .get_stream_func = NULL, 79 .set_stream_func = NULL, 80 } 81 } 82 }; 83 84/* Register this device type. */ 85void 86goacc_host_init (void) 87{ 88 gomp_mutex_init (&host_dispatch.lock); 89 goacc_register (&host_dispatch); 90} 91