111
|
1 /* OpenACC Runtime Library Definitions.
|
|
2
|
131
|
3 Copyright (C) 2013-2018 Free Software Foundation, Inc.
|
111
|
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 #include <assert.h>
|
|
30 #include "openacc.h"
|
|
31 #include "libgomp.h"
|
|
32 #include "oacc-int.h"
|
|
33
|
|
34 int
|
|
35 acc_async_test (int async)
|
|
36 {
|
131
|
37 if (!async_valid_p (async))
|
111
|
38 gomp_fatal ("invalid async argument: %d", async);
|
|
39
|
|
40 struct goacc_thread *thr = goacc_thread ();
|
|
41
|
|
42 if (!thr || !thr->dev)
|
|
43 gomp_fatal ("no device active");
|
|
44
|
|
45 return thr->dev->openacc.async_test_func (async);
|
|
46 }
|
|
47
|
|
48 int
|
|
49 acc_async_test_all (void)
|
|
50 {
|
|
51 struct goacc_thread *thr = goacc_thread ();
|
|
52
|
|
53 if (!thr || !thr->dev)
|
|
54 gomp_fatal ("no device active");
|
|
55
|
|
56 return thr->dev->openacc.async_test_all_func ();
|
|
57 }
|
|
58
|
|
59 void
|
|
60 acc_wait (int async)
|
|
61 {
|
131
|
62 if (!async_valid_p (async))
|
111
|
63 gomp_fatal ("invalid async argument: %d", async);
|
|
64
|
|
65 struct goacc_thread *thr = goacc_thread ();
|
|
66
|
|
67 if (!thr || !thr->dev)
|
|
68 gomp_fatal ("no device active");
|
|
69
|
|
70 thr->dev->openacc.async_wait_func (async);
|
|
71 }
|
|
72
|
|
73 /* acc_async_wait is an OpenACC 1.0 compatibility name for acc_wait. */
|
|
74 #ifdef HAVE_ATTRIBUTE_ALIAS
|
|
75 strong_alias (acc_wait, acc_async_wait)
|
|
76 #else
|
|
77 void
|
|
78 acc_async_wait (int async)
|
|
79 {
|
|
80 acc_wait (async);
|
|
81 }
|
|
82 #endif
|
|
83
|
|
84 void
|
|
85 acc_wait_async (int async1, int async2)
|
|
86 {
|
|
87 struct goacc_thread *thr = goacc_thread ();
|
|
88
|
|
89 if (!thr || !thr->dev)
|
|
90 gomp_fatal ("no device active");
|
|
91
|
|
92 thr->dev->openacc.async_wait_async_func (async1, async2);
|
|
93 }
|
|
94
|
|
95 void
|
|
96 acc_wait_all (void)
|
|
97 {
|
|
98 struct goacc_thread *thr = goacc_thread ();
|
|
99
|
|
100 if (!thr || !thr->dev)
|
|
101 gomp_fatal ("no device active");
|
|
102
|
|
103 thr->dev->openacc.async_wait_all_func ();
|
|
104 }
|
|
105
|
|
106 /* acc_async_wait_all is an OpenACC 1.0 compatibility name for acc_wait_all. */
|
|
107 #ifdef HAVE_ATTRIBUTE_ALIAS
|
|
108 strong_alias (acc_wait_all, acc_async_wait_all)
|
|
109 #else
|
|
110 void
|
|
111 acc_async_wait_all (void)
|
|
112 {
|
|
113 acc_wait_all ();
|
|
114 }
|
|
115 #endif
|
|
116
|
|
117 void
|
|
118 acc_wait_all_async (int async)
|
|
119 {
|
131
|
120 if (!async_valid_p (async))
|
111
|
121 gomp_fatal ("invalid async argument: %d", async);
|
|
122
|
|
123 struct goacc_thread *thr = goacc_thread ();
|
|
124
|
|
125 if (!thr || !thr->dev)
|
|
126 gomp_fatal ("no device active");
|
|
127
|
|
128 thr->dev->openacc.async_wait_all_async_func (async);
|
|
129 }
|