[Openmp-commits] [PATCH] D44793: Fixed __kmpc_get_target_offload() to call initialization.

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 22 10:36:51 PDT 2018

AndreyChurbanov created this revision.
AndreyChurbanov added a reviewer: tlwilmar.
Herald added a subscriber: openmp-commits.

The __kmpc_get_target_offload() supposed to react on the OMP_TARGET_OFFLOAD environment variable setting.
Calling serial initialization causes the library to read the environment, then the routine returns correct value set by user.

  rOMP OpenMP



Index: runtime/src/kmp_csupport.cpp
--- runtime/src/kmp_csupport.cpp
+++ runtime/src/kmp_csupport.cpp
@@ -4066,7 +4066,12 @@
-int __kmpc_get_target_offload(void) { return __kmp_target_offload; }
+int __kmpc_get_target_offload(void) {
+  if (!__kmp_init_serial) {
+    __kmp_serial_initialize();
+  }
+  return __kmp_target_offload;
 #endif // OMP_50_ENABLED
 // end of file //

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44793.139470.patch
Type: text/x-patch
Size: 480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180322/d12a4365/attachment.bin>

More information about the Openmp-commits mailing list