1 /* OpenACC Runtime Library: acc_device_host.
3 Copyright (C) 2013-2014 Free Software Foundation, Inc.
5 Contributed by Mentor Embedded.
7 This file is part of the GNU Offloading and Multi Processing Library
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)
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
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.
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/>. */
29 /* This shares much of the implementation of the plugin-host.c "host_nonshm"
31 #include "plugin/plugin-host.c"
33 static struct gomp_device_descr host_dispatch
=
37 .type
= OFFLOAD_TARGET_TYPE_HOST
,
38 .capabilities
= TARGET_CAP_OPENACC_200
| TARGET_CAP_NATIVE_EXEC
39 | TARGET_CAP_SHARED_MEM
,
42 .is_initialized
= false,
43 .offload_regions_registered
= false,
45 .get_name_func
= GOMP_OFFLOAD_get_name
,
46 .get_type_func
= GOMP_OFFLOAD_get_type
,
47 .get_caps_func
= GOMP_OFFLOAD_get_caps
,
49 .init_device_func
= GOMP_OFFLOAD_init_device
,
50 .fini_device_func
= GOMP_OFFLOAD_fini_device
,
51 .get_num_devices_func
= GOMP_OFFLOAD_get_num_devices
,
52 .register_image_func
= GOMP_OFFLOAD_register_image
,
53 .get_table_func
= GOMP_OFFLOAD_get_table
,
55 .alloc_func
= GOMP_OFFLOAD_alloc
,
56 .free_func
= GOMP_OFFLOAD_free
,
57 .host2dev_func
= GOMP_OFFLOAD_host2dev
,
58 .dev2host_func
= GOMP_OFFLOAD_dev2host
,
60 .run_func
= GOMP_OFFLOAD_run
,
63 .open_device_func
= GOMP_OFFLOAD_openacc_open_device
,
64 .close_device_func
= GOMP_OFFLOAD_openacc_close_device
,
66 .get_device_num_func
= GOMP_OFFLOAD_openacc_get_device_num
,
67 .set_device_num_func
= GOMP_OFFLOAD_openacc_set_device_num
,
69 .exec_func
= GOMP_OFFLOAD_openacc_parallel
,
71 .register_async_cleanup_func
72 = GOMP_OFFLOAD_openacc_register_async_cleanup
,
74 .async_set_async_func
= GOMP_OFFLOAD_openacc_async_set_async
,
75 .async_test_func
= GOMP_OFFLOAD_openacc_async_test
,
76 .async_test_all_func
= GOMP_OFFLOAD_openacc_async_test_all
,
77 .async_wait_func
= GOMP_OFFLOAD_openacc_async_wait
,
78 .async_wait_async_func
= GOMP_OFFLOAD_openacc_async_wait_async
,
79 .async_wait_all_func
= GOMP_OFFLOAD_openacc_async_wait_all
,
80 .async_wait_all_async_func
= GOMP_OFFLOAD_openacc_async_wait_all_async
,
82 .create_thread_data_func
= GOMP_OFFLOAD_openacc_create_thread_data
,
83 .destroy_thread_data_func
= GOMP_OFFLOAD_openacc_destroy_thread_data
,
86 .get_current_device_func
= NULL
,
87 .get_current_context_func
= NULL
,
88 .get_stream_func
= NULL
,
89 .set_stream_func
= NULL
,
94 /* Register this device type. */
95 static __attribute__ ((constructor
))
96 void goacc_host_init (void)
98 gomp_mutex_init (&host_dispatch
.mem_map
.lock
);
99 goacc_register (&host_dispatch
);