1// RUN: %libomptarget-compile-generic
2// RUN: env LIBOMPTARGET_DEBUG=1 %libomptarget-run-generic 2>&1 \
3// RUN: %fcheck-generic
4
5// REQUIRES: libomptarget-debug
6
7#include <omp.h>
8#include <stdio.h>
9
10extern void __tgt_rtl_init(void);
11extern void __tgt_rtl_deinit(void);
12
13// Sanity checks to make sure that this works and is thread safe.
14int main() {
15 // CHECK: Init offload library!
16 // CHECK: Deinit offload library!
17 __tgt_rtl_init();
18#pragma omp parallel num_threads(8)
19 {
20 __tgt_rtl_init();
21 __tgt_rtl_deinit();
22 }
23 __tgt_rtl_deinit();
24
25 __tgt_rtl_init();
26 __tgt_rtl_deinit();
27
28 // CHECK: PASS
29 printf(format: "PASS\n");
30}
31

source code of offload/test/offloading/runtime_init.c