aboutsummaryrefslogtreecommitdiff
path: root/offload/test/offloading/runtime_init.c
blob: 96fd50f51da1e82a607bd078e1097bc0930ccd63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %libomptarget-compile-generic
// RUN:   env LIBOMPTARGET_DEBUG=1 %libomptarget-run-generic 2>&1 \
// RUN: %fcheck-generic

// REQUIRES: libomptarget-debug

#include <omp.h>
#include <stdio.h>

extern void __tgt_rtl_init(void);
extern void __tgt_rtl_deinit(void);

// Sanity checks to make sure that this works and is thread safe.
int main() {
  // CHECK: Init offload library!
  // CHECK: Deinit offload library!
  __tgt_rtl_init();
#pragma omp parallel num_threads(8)
  {
    __tgt_rtl_init();
    __tgt_rtl_deinit();
  }
  __tgt_rtl_deinit();

  __tgt_rtl_init();
  __tgt_rtl_deinit();

  // CHECK: PASS
  printf("PASS\n");
}