-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link libdl as interface library #5179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I think it's better to link the library like you did rather than adding yet another code path in the cmake
I don't fully understand how specifying the |
@@ -1 +1 @@ | |||
KOKKOS_FIND_IMPORTED(LIBDL HEADER dlfcn.h LIBRARY dl) | |||
KOKKOS_FIND_IMPORTED(LIBDL HEADER dlfcn.h INTERFACE LIBRARIES ${CMAKE_DL_LIBS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why LIBRARY
-> LIBRARIES
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This required fewer changes. KOKKOS_CREATE_IMPORTED_TPL
(called by KOKKOS_FIND_IMPORTED
) treats LIBRARY
(referenced as TPL_LIBRARY
) as IMPORTED_LOCATION
but uses TARGET_LINK_LIBRARIES
for LIBRARIES
(referenced as TPL_LINK_LIBRARIES
). In particular, we currently error out if KOKKOS_CREATE_IMPORTED_TPL
called for an interface library gets a LIBRARY
argument passed.
Without kokkos/cmake/kokkos_functions.cmake Lines 309 to 370 in d19aab9
|
Ok, so the difference between passing kokkos/cmake/kokkos_functions.cmake Lines 632 to 638 in 86af51d
And if I didn't look at the implementation, I would intuitively expect something like: FOREACH(LIB ${TPL_LIBRARIES})
do-the-same-stuff-we-do-for-single-library()
ENDFOREACH() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Profiling is useful for us and downstream users and we should turn it on when possible The Kokkos issue raised at kokkos/kokkos#4824 seems to have been fixed by kokkos/kokkos#5179 This MR effectively reverts !4890
Fixes #4824. Basically, this just uses
-ldl
instead of the full library path for linking but we still try to find the library and add the include path fordlfcn.h
.An alternative to changing
${NAME}_FOUND_LIBRARIES
for interface libraries, would be to not provide the library name in the initial call but add${CMAKE_DL_LIBS}
viatarget_link_libraries
later.I opted for the current approach since it feels less of a workaround, and interface libraries are not supposed to depend on hardcoded library paths anyway.