[Openmp-commits] [openmp] [Libomptarget] Remove global ctor and use reference counting (PR #80499)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 6 08:38:57 PST 2024


================
@@ -0,0 +1,24 @@
+// RUN: %libomptarget-compile-run-and-check-generic
+
+#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() {
+  __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");
+}
----------------
jdoerfert wrote:

The test is not perfect but I'm unsure how to improve it. 

https://github.com/llvm/llvm-project/pull/80499


More information about the Openmp-commits mailing list