1*38fd1498Szrj /* Copyright (C) 2005-2018 Free Software Foundation, Inc.
2*38fd1498Szrj Contributed by Richard Henderson <rth@redhat.com>.
3*38fd1498Szrj
4*38fd1498Szrj This file is part of the GNU Offloading and Multi Processing Library
5*38fd1498Szrj (libgomp).
6*38fd1498Szrj
7*38fd1498Szrj Libgomp is free software; you can redistribute it and/or modify it
8*38fd1498Szrj under the terms of the GNU General Public License as published by
9*38fd1498Szrj the Free Software Foundation; either version 3, or (at your option)
10*38fd1498Szrj any later version.
11*38fd1498Szrj
12*38fd1498Szrj Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
13*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14*38fd1498Szrj FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15*38fd1498Szrj more details.
16*38fd1498Szrj
17*38fd1498Szrj Under Section 7 of GPL version 3, you are granted additional
18*38fd1498Szrj permissions described in the GCC Runtime Library Exception, version
19*38fd1498Szrj 3.1, as published by the Free Software Foundation.
20*38fd1498Szrj
21*38fd1498Szrj You should have received a copy of the GNU General Public License and
22*38fd1498Szrj a copy of the GCC Runtime Library Exception along with this program;
23*38fd1498Szrj see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24*38fd1498Szrj <http://www.gnu.org/licenses/>. */
25*38fd1498Szrj
26*38fd1498Szrj /* This file defines OpenMP API entry points that accelerator targets are
27*38fd1498Szrj expected to replace. */
28*38fd1498Szrj
29*38fd1498Szrj #include "libgomp.h"
30*38fd1498Szrj
31*38fd1498Szrj void
omp_set_default_device(int device_num)32*38fd1498Szrj omp_set_default_device (int device_num)
33*38fd1498Szrj {
34*38fd1498Szrj struct gomp_task_icv *icv = gomp_icv (true);
35*38fd1498Szrj icv->default_device_var = device_num >= 0 ? device_num : 0;
36*38fd1498Szrj }
37*38fd1498Szrj
38*38fd1498Szrj int
omp_get_default_device(void)39*38fd1498Szrj omp_get_default_device (void)
40*38fd1498Szrj {
41*38fd1498Szrj struct gomp_task_icv *icv = gomp_icv (false);
42*38fd1498Szrj return icv->default_device_var;
43*38fd1498Szrj }
44*38fd1498Szrj
45*38fd1498Szrj int
omp_get_num_devices(void)46*38fd1498Szrj omp_get_num_devices (void)
47*38fd1498Szrj {
48*38fd1498Szrj return gomp_get_num_devices ();
49*38fd1498Szrj }
50*38fd1498Szrj
51*38fd1498Szrj int
omp_get_num_teams(void)52*38fd1498Szrj omp_get_num_teams (void)
53*38fd1498Szrj {
54*38fd1498Szrj /* Hardcoded to 1 on host, MIC, HSAIL? Maybe variable on PTX. */
55*38fd1498Szrj return 1;
56*38fd1498Szrj }
57*38fd1498Szrj
58*38fd1498Szrj int
omp_get_team_num(void)59*38fd1498Szrj omp_get_team_num (void)
60*38fd1498Szrj {
61*38fd1498Szrj /* Hardcoded to 0 on host, MIC, HSAIL? Maybe variable on PTX. */
62*38fd1498Szrj return 0;
63*38fd1498Szrj }
64*38fd1498Szrj
65*38fd1498Szrj int
omp_is_initial_device(void)66*38fd1498Szrj omp_is_initial_device (void)
67*38fd1498Szrj {
68*38fd1498Szrj /* Hardcoded to 1 on host, should be 0 on MIC, HSAIL, PTX. */
69*38fd1498Szrj return 1;
70*38fd1498Szrj }
71*38fd1498Szrj
72*38fd1498Szrj ialias (omp_set_default_device)
73*38fd1498Szrj ialias (omp_get_default_device)
74*38fd1498Szrj ialias (omp_get_num_devices)
75*38fd1498Szrj ialias (omp_get_num_teams)
76*38fd1498Szrj ialias (omp_get_team_num)
77*38fd1498Szrj ialias (omp_is_initial_device)
78