Skip to content

Commit 8f88675

Browse files
XiaobingSuperEikanWang
authored andcommitted
fix potential issue which dlopen may return null value (#352)
* fix potential issue which dlopen may return null value * fix issue when call dlopen
1 parent d1ed5a1 commit 8f88675

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

torch_ipex/csrc/cpu/runtime/CPUPool.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ bool iomp_symbol_loaded{
1717
} // namespace
1818

1919
void loading_iomp_symbol() {
20-
void* handle = dlopen(NULL, RTLD_GLOBAL);
21-
22-
if (dlsym(handle, "kmp_create_affinity_mask") == NULL ||
20+
void* handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
21+
if (handle == NULL || dlsym(handle, "kmp_create_affinity_mask") == NULL ||
2322
dlsym(handle, "kmp_set_affinity_mask_proc") == NULL ||
2423
dlsym(handle, "kmp_set_affinity") == NULL ||
2524
dlsym(handle, "kmp_get_affinity") == NULL ||

0 commit comments

Comments
 (0)