[Openmp-commits] [PATCH] D87413: [OpenMP] Load plugins from same directory as the libomptarget.so

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 9 16:57:40 PDT 2020


jdoerfert added inline comments.


================
Comment at: openmp/libomptarget/src/rtl.cpp:74
+  std::string full_plugin_name;
+  bool loadPluginsFromSameDir = false;
+  void *handle;
----------------
Not needed.


================
Comment at: openmp/libomptarget/src/rtl.cpp:87-103
+      DP("Trying to load plugins from same directory as libomptarget.so: %s\n",
+         Name);
+      handle = dlopen("libomptarget.so", RTLD_NOW);
+      if (!handle) {
+        DP("Unable to load library '%s': %s!\n", Name, dlerror());
+        continue;
+      }
----------------
RaviNarayanaswamy wrote:
> Do we need to repeat this everytime in the for loop
We do not. If needed, try to find the path of libomptarget once. Please put that code in a helper method.


================
Comment at: openmp/libomptarget/src/rtl.cpp:89
+         Name);
+      handle = dlopen("libomptarget.so", RTLD_NOW);
+      if (!handle) {
----------------



================
Comment at: openmp/libomptarget/src/rtl.cpp:117-118
+    DP("Successfully loaded library '%s'!\n",
+       loadPluginsFromSameDir ? full_plugin_name.c_str() : Name);
+    loadPluginsFromSameDir = false;
 
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87413/new/

https://reviews.llvm.org/D87413



More information about the Openmp-commits mailing list