Files
llvm/offload/test/offloading/get_num_devices_device.c
Alex Duran 36f307fed3 [Offload][Omp] Mark aarch64 as unsupported in get_num_devices_device test (#240399)
The test get_num_devices_device.c was added in #238271 and marked x86_64
as unsupported but it seems we also need to mark aarch64.
2026-11-10 10:07:16 +00:00

37 lines
841 B
C

// Check that omp_get_num_devices() and omp_get_device_num() called from a
// target region report the host's view (device count and OpenMP device id).
// RUN: %libomptarget-compile-run-and-check-generic
// REQUIRES: gpu
#include <omp.h>
#include <stdio.h>
int main() {
int HostNum = omp_get_num_devices();
int Fail = 0;
for (int Dev = 0; Dev < HostNum; ++Dev) {
int DeviceNum = -1;
int DeviceID = -1;
#pragma omp target device(Dev) map(from : DeviceNum, DeviceID)
{
DeviceNum = omp_get_num_devices();
DeviceID = omp_get_device_num();
}
if (DeviceNum != HostNum || DeviceID != Dev) {
printf("FAIL: dev=%d host_num=%d device_num=%d device_id=%d\n", Dev,
HostNum, DeviceNum, DeviceID);
Fail = 1;
}
}
// CHECK: PASS
if (!Fail)
printf("PASS\n");
return 0;
}