Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / mandatory_but_no_devices.c
blobecdee72acad04fa0ebada329875070585c9535c1
1 // Check that mandatory offloading causes various offloading directives to fail
2 // when omp_get_num_devices() == 0 even if the requested device is the initial
3 // device. This behavior is proposed for OpenMP 5.2 in OpenMP spec github
4 // issue 2669.
6 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR=target
7 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
8 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
9 // RUN: %fcheck-nvptx64-nvidia-cuda
11 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR='target teams'
12 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
13 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
14 // RUN: %fcheck-nvptx64-nvidia-cuda
16 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR='target data map(X)'
17 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
18 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
19 // RUN: %fcheck-nvptx64-nvidia-cuda
21 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda \
22 // RUN: -DDIR='target enter data map(to:X)'
23 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
24 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
25 // RUN: %fcheck-nvptx64-nvidia-cuda
27 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda \
28 // RUN: -DDIR='target exit data map(from:X)'
29 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
30 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
31 // RUN: %fcheck-nvptx64-nvidia-cuda
33 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda \
34 // RUN: -DDIR='target update to(X)'
35 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
36 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
37 // RUN: %fcheck-nvptx64-nvidia-cuda
39 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda \
40 // RUN: -DDIR='target update from(X)'
41 // RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
42 // RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
43 // RUN: %fcheck-nvptx64-nvidia-cuda
45 // REQUIRES: nvptx64-nvidia-cuda
47 #include <omp.h>
48 #include <stdio.h>
50 // CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory
51 int main(void) {
52 int X;
53 #pragma omp DIR device(omp_get_initial_device())
55 return 0;