1 /* Copyright (C) 2013 Free Software Foundation, Inc.
2 Contributed by Jakub Jelinek <jakub@redhat.com>.
4 This file is part of the GNU OpenMP Library (libgomp).
6 Libgomp is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 /* This file handles the maintainence of threads in response to team
26 creation and termination. */
35 gomp_get_num_devices (void)
40 /* Called when encountering a target directive. If DEVICE
41 is -1, it means use device-var ICV. If it is -2 (or any other value
42 larger than last available hw device, use host fallback.
43 FN is address of host code, OPENMP_TARGET contains value of the
44 __OPENMP_TARGET__ symbol in the shared library or binary that invokes
45 GOMP_target. HOSTADDRS, SIZES and KINDS are arrays
46 with MAPNUM entries, with addresses of the host objects,
47 sizes of the host objects (resp. for pointer kind pointer bias
48 and assumed sizeof (void *) size) and kinds. */
51 GOMP_target (int device
, void (*fn
) (void *), const void *openmp_target
,
52 size_t mapnum
, void **hostaddrs
, size_t *sizes
,
56 struct gomp_thread old_thr
, *thr
= gomp_thread ();
58 memset (thr
, '\0', sizeof (*thr
));
61 thr
->place
= old_thr
.place
;
62 thr
->ts
.place_partition_len
= gomp_places_list_len
;
65 gomp_free_thread (thr
);
70 GOMP_target_data (int device
, const void *openmp_target
, size_t mapnum
,
71 void **hostaddrs
, size_t *sizes
, unsigned char *kinds
)
76 GOMP_target_end_data (void)
81 GOMP_target_update (int device
, const void *openmp_target
, size_t mapnum
,
82 void **hostaddrs
, size_t *sizes
, unsigned char *kinds
)
87 GOMP_teams (unsigned int num_teams
, unsigned int thread_limit
)
91 struct gomp_task_icv
*icv
= gomp_icv (true);
93 = thread_limit
> INT_MAX
? UINT_MAX
: thread_limit
;