LLVM OpenMP
runtime
unittests
Traits
MockOMP.cpp
Go to the documentation of this file.
1
//===- MockOMP.cpp - Mock OMP functions for testing ----------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// Mock implementations for OMP functions (libomptarget not available in tests).
10
//
11
//===----------------------------------------------------------------------===//
12
13
// Mock device count for testing
14
static
int
MockNumDevices
= 4;
15
static
const
char
*
MockDeviceUIDs
[] = {
"device-0"
,
"device-1"
,
"device-2"
,
16
"device-3"
};
17
18
extern
"C"
int
omp_get_num_devices
() {
return
MockNumDevices
; }
19
20
extern
"C"
const
char
*
omp_get_uid_from_device
(
int
DeviceNum) {
21
if
(DeviceNum >= 0 && DeviceNum <
MockNumDevices
)
22
return
MockDeviceUIDs
[DeviceNum];
23
return
""
;
24
}
omp_get_num_devices
int omp_get_num_devices()
Definition
MockOMP.cpp:18
omp_get_uid_from_device
const char * omp_get_uid_from_device(int DeviceNum)
Definition
MockOMP.cpp:20
MockNumDevices
static int MockNumDevices
Definition
MockOMP.cpp:14
MockDeviceUIDs
static const char * MockDeviceUIDs[]
Definition
MockOMP.cpp:15
Generated on
for LLVM OpenMP by
1.14.0