1*b1e83836Smrg /* Copyright (C) 2006-2022 Free Software Foundation, Inc.
2b17d1066Smrg Contributed by Jakub Jelinek <jakub@redhat.com>.
3b17d1066Smrg
4b17d1066Smrg This file is part of the GNU Offloading and Multi Processing Library
5b17d1066Smrg (libgomp).
6b17d1066Smrg
7b17d1066Smrg Libgomp is free software; you can redistribute it and/or modify it
8b17d1066Smrg under the terms of the GNU General Public License as published by
9b17d1066Smrg the Free Software Foundation; either version 3, or (at your option)
10b17d1066Smrg any later version.
11b17d1066Smrg
12b17d1066Smrg Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
13b17d1066Smrg WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14b17d1066Smrg FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15b17d1066Smrg more details.
16b17d1066Smrg
17b17d1066Smrg Under Section 7 of GPL version 3, you are granted additional
18b17d1066Smrg permissions described in the GCC Runtime Library Exception, version
19b17d1066Smrg 3.1, as published by the Free Software Foundation.
20b17d1066Smrg
21b17d1066Smrg You should have received a copy of the GNU General Public License and
22b17d1066Smrg a copy of the GCC Runtime Library Exception along with this program;
23b17d1066Smrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24b17d1066Smrg <http://www.gnu.org/licenses/>. */
25b17d1066Smrg
26b17d1066Smrg /* This is a generic stub implementation of a CPU affinity setting. */
27b17d1066Smrg
28b17d1066Smrg #include "libgomp.h"
29181254a7Smrg #include <string.h>
30181254a7Smrg #include <stdio.h>
31b17d1066Smrg
32b17d1066Smrg void
gomp_init_affinity(void)33b17d1066Smrg gomp_init_affinity (void)
34b17d1066Smrg {
35b17d1066Smrg }
36b17d1066Smrg
37b17d1066Smrg #ifdef LIBGOMP_USE_PTHREADS
38b17d1066Smrg void
gomp_init_thread_affinity(pthread_attr_t * attr,unsigned int place)39b17d1066Smrg gomp_init_thread_affinity (pthread_attr_t *attr, unsigned int place)
40b17d1066Smrg {
41b17d1066Smrg (void) attr;
42b17d1066Smrg (void) place;
43b17d1066Smrg }
44b17d1066Smrg #endif
45b17d1066Smrg
46b17d1066Smrg void **
gomp_affinity_alloc(unsigned long count,bool quiet)47b17d1066Smrg gomp_affinity_alloc (unsigned long count, bool quiet)
48b17d1066Smrg {
49b17d1066Smrg (void) count;
50b17d1066Smrg if (!quiet)
51b17d1066Smrg gomp_error ("Affinity not supported on this configuration");
52b17d1066Smrg return NULL;
53b17d1066Smrg }
54b17d1066Smrg
55b17d1066Smrg void
gomp_affinity_init_place(void * p)56b17d1066Smrg gomp_affinity_init_place (void *p)
57b17d1066Smrg {
58b17d1066Smrg (void) p;
59b17d1066Smrg }
60b17d1066Smrg
61b17d1066Smrg bool
gomp_affinity_add_cpus(void * p,unsigned long num,unsigned long len,long stride,bool quiet)62b17d1066Smrg gomp_affinity_add_cpus (void *p, unsigned long num,
63b17d1066Smrg unsigned long len, long stride, bool quiet)
64b17d1066Smrg {
65b17d1066Smrg (void) p;
66b17d1066Smrg (void) num;
67b17d1066Smrg (void) len;
68b17d1066Smrg (void) stride;
69b17d1066Smrg (void) quiet;
70b17d1066Smrg return false;
71b17d1066Smrg }
72b17d1066Smrg
73b17d1066Smrg bool
gomp_affinity_remove_cpu(void * p,unsigned long num)74b17d1066Smrg gomp_affinity_remove_cpu (void *p, unsigned long num)
75b17d1066Smrg {
76b17d1066Smrg (void) p;
77b17d1066Smrg (void) num;
78b17d1066Smrg return false;
79b17d1066Smrg }
80b17d1066Smrg
81b17d1066Smrg bool
gomp_affinity_copy_place(void * p,void * q,long stride)82b17d1066Smrg gomp_affinity_copy_place (void *p, void *q, long stride)
83b17d1066Smrg {
84b17d1066Smrg (void) p;
85b17d1066Smrg (void) q;
86b17d1066Smrg (void) stride;
87b17d1066Smrg return false;
88b17d1066Smrg }
89b17d1066Smrg
90b17d1066Smrg bool
gomp_affinity_same_place(void * p,void * q)91b17d1066Smrg gomp_affinity_same_place (void *p, void *q)
92b17d1066Smrg {
93b17d1066Smrg (void) p;
94b17d1066Smrg (void) q;
95b17d1066Smrg return false;
96b17d1066Smrg }
97b17d1066Smrg
98b17d1066Smrg bool
gomp_affinity_finalize_place_list(bool quiet)99b17d1066Smrg gomp_affinity_finalize_place_list (bool quiet)
100b17d1066Smrg {
101b17d1066Smrg (void) quiet;
102b17d1066Smrg return false;
103b17d1066Smrg }
104b17d1066Smrg
105b17d1066Smrg bool
gomp_affinity_init_level(int level,unsigned long count,bool quiet)106b17d1066Smrg gomp_affinity_init_level (int level, unsigned long count, bool quiet)
107b17d1066Smrg {
108b17d1066Smrg (void) level;
109b17d1066Smrg (void) count;
110b17d1066Smrg (void) quiet;
111b17d1066Smrg if (!quiet)
112b17d1066Smrg gomp_error ("Affinity not supported on this configuration");
113b17d1066Smrg return NULL;
114b17d1066Smrg }
115b17d1066Smrg
116b17d1066Smrg void
gomp_affinity_print_place(void * p)117b17d1066Smrg gomp_affinity_print_place (void *p)
118b17d1066Smrg {
119b17d1066Smrg (void) p;
120b17d1066Smrg }
121b17d1066Smrg
122b17d1066Smrg int
omp_get_place_num_procs(int place_num)123b17d1066Smrg omp_get_place_num_procs (int place_num)
124b17d1066Smrg {
125b17d1066Smrg (void) place_num;
126b17d1066Smrg return 0;
127b17d1066Smrg }
128b17d1066Smrg
129b17d1066Smrg void
omp_get_place_proc_ids(int place_num,int * ids)130b17d1066Smrg omp_get_place_proc_ids (int place_num, int *ids)
131b17d1066Smrg {
132b17d1066Smrg (void) place_num;
133b17d1066Smrg (void) ids;
134b17d1066Smrg }
135b17d1066Smrg
136b17d1066Smrg void
gomp_get_place_proc_ids_8(int place_num,int64_t * ids)137b17d1066Smrg gomp_get_place_proc_ids_8 (int place_num, int64_t *ids)
138b17d1066Smrg {
139b17d1066Smrg (void) place_num;
140b17d1066Smrg (void) ids;
141b17d1066Smrg }
142b17d1066Smrg
143181254a7Smrg void
gomp_display_affinity_place(char * buffer,size_t size,size_t * ret,int place)144181254a7Smrg gomp_display_affinity_place (char *buffer, size_t size, size_t *ret,
145181254a7Smrg int place)
146181254a7Smrg {
147181254a7Smrg char buf[sizeof (long) * 3 + 4];
148181254a7Smrg if (gomp_available_cpus > 1)
149181254a7Smrg sprintf (buf, "0-%lu", gomp_available_cpus - 1);
150181254a7Smrg else
151181254a7Smrg strcpy (buf, "0");
152181254a7Smrg gomp_display_string (buffer, size, ret, buf, strlen (buf));
153181254a7Smrg }
154181254a7Smrg
155b17d1066Smrg ialias(omp_get_place_num_procs)
156b17d1066Smrg ialias(omp_get_place_proc_ids)
157