LLVM OpenMP
runtime
test
env
omp_num_threads_host_vs_device.c
Go to the documentation of this file.
1
// RUN: %libomp-compile && \
2
// RUN: env OMP_NUM_THREADS=4 OMP_NUM_THREADS_ALL=8 \
3
// RUN: OMP_NUM_THREADS_DEV_0=128 %libomp-run
4
//
5
// Host ICV via omp_get_max_threads; devices via __kmpc_get_device_env.
6
7
#include <omp.h>
8
#include <stdio.h>
9
#include <string.h>
10
11
extern
const
char
*
__kmpc_get_device_env
(
const
char
*
name
,
int
device_id);
12
13
int
main
(
void
) {
14
if
(
omp_get_max_threads
() != 4)
15
return
1;
16
17
// Device 0 uses _DEV_0; device 1 falls through to _ALL.
18
const
char
*dev0 =
__kmpc_get_device_env
(
"OMP_NUM_THREADS"
, 0);
19
if
(dev0 == NULL || strcmp(dev0,
"128"
) != 0)
20
return
2;
21
const
char
*dev1 =
__kmpc_get_device_env
(
"OMP_NUM_THREADS"
, 1);
22
if
(dev1 == NULL || strcmp(dev1,
"8"
) != 0)
23
return
3;
24
25
return
0;
26
}
name
__itt_string_handle * name
Definition
ittnotify.h:3305
main
int main(void)
Definition
omp_num_threads_host_vs_device.c:13
__kmpc_get_device_env
const char * __kmpc_get_device_env(const char *name, int device_id)
Definition
kmp_device_env.cpp:311
omp_get_max_threads
int omp_get_max_threads()
Generated on
for LLVM OpenMP by
1.14.0