96 lines · c
1// Check that mandatory offloading causes various offloading directives to fail2// when omp_get_num_devices() == 0 even if the requested device is the initial3// device. This behavior is proposed for OpenMP 5.2 in OpenMP spec github4// issue 2669.5 6// AMD Tests7// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR=target8// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \9// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \10// RUN: %fcheck-amdgcn-amd-amdhsa11 12// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR='target teams'13// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \14// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \15// RUN: %fcheck-amdgcn-amd-amdhsa16 17// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR='target data map(X)'18// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \19// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \20// RUN: %fcheck-amdgcn-amd-amdhsa21 22// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \23// RUN: -DDIR='target enter data map(to:X)'24// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \25// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \26// RUN: %fcheck-amdgcn-amd-amdhsa27 28// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \29// RUN: -DDIR='target exit data map(from:X)'30// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \31// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \32// RUN: %fcheck-amdgcn-amd-amdhsa33 34// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \35// RUN: -DDIR='target update to(X)'36// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \37// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \38// RUN: %fcheck-amdgcn-amd-amdhsa39 40// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \41// RUN: -DDIR='target update from(X)'42// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \43// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \44// RUN: %fcheck-amdgcn-amd-amdhsa45 46// Nvidia Tests47// RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR=target48// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \49// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \50// RUN: %fcheck-nvptx64-nvidia-cuda51 52// RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR='target teams'53// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \54// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \55// RUN: %fcheck-nvptx64-nvidia-cuda56 57// RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR='target data map(X)'58// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \59// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \60// RUN: %fcheck-nvptx64-nvidia-cuda61 62// RUN: %libomptarget-compile-nvptx64-nvidia-cuda \63// RUN: -DDIR='target enter data map(to:X)'64// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \65// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \66// RUN: %fcheck-nvptx64-nvidia-cuda67 68// RUN: %libomptarget-compile-nvptx64-nvidia-cuda \69// RUN: -DDIR='target exit data map(from:X)'70// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \71// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \72// RUN: %fcheck-nvptx64-nvidia-cuda73 74// RUN: %libomptarget-compile-nvptx64-nvidia-cuda \75// RUN: -DDIR='target update to(X)'76// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \77// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \78// RUN: %fcheck-nvptx64-nvidia-cuda79 80// RUN: %libomptarget-compile-nvptx64-nvidia-cuda \81// RUN: -DDIR='target update from(X)'82// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \83// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \84// RUN: %fcheck-nvptx64-nvidia-cuda85 86#include <omp.h>87#include <stdio.h>88 89// CHECK: omptarget fatal error 1: failure of target construct while offloading is mandatory90int main(void) {91 int X;92#pragma omp DIR device(omp_get_initial_device())93 ;94 return 0;95}96