LLVM OpenMP
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
14static int MockNumDevices = 4;
15static const char *MockDeviceUIDs[] = {"device-0", "device-1", "device-2",
16 "device-3"};
17
18extern "C" int omp_get_num_devices() { return MockNumDevices; }
19
20extern "C" const char *omp_get_uid_from_device(int DeviceNum) {
21 if (DeviceNum >= 0 && DeviceNum < MockNumDevices)
22 return MockDeviceUIDs[DeviceNum];
23 return "";
24}
int omp_get_num_devices()
Definition MockOMP.cpp:18
const char * omp_get_uid_from_device(int DeviceNum)
Definition MockOMP.cpp:20
static int MockNumDevices
Definition MockOMP.cpp:14
static const char * MockDeviceUIDs[]
Definition MockOMP.cpp:15