-
Notifications
You must be signed in to change notification settings - Fork 166
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
[cmake] Allow users to link against onemath_<domain>_<backend> targets #627
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.
Thanks for the improvements, I like this.
Would it be possible (probably in a different PR) to have shared code between the many nearly identical CMakeLists.txt
files? Then a PR like this would only have to change a couple files instead of 38.
I'm not sure, it may not be that easy to share common code in the Also I am planning to focus more on issues we need to fix for other projects or issues reported by users when possible. |
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. Thanks a lot for the improvements! Ping @andreyfe1 to double-check if I missed something.
By the way, do you know why the compile-time dispatching examples require both mklcpu and cuda backends? I was wondering if this is a good idea...
No real reasons other than the examples have been written this way. I suppose the idea is that we expect this may be more useful for most users. |
2ed4d5e
to
e751460
Compare
@andreyfe1 I have added back the |
Thanks @Rbiessy. CMake generation looks good now. |
Oh I see the issue. I linked that example against the On a separate note when I try to run this example locally I get |
Thanks @Rbiessy. I'll do experiments locally |
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.
Local testing is good enough. Thanks for changes!
Description
The goal of this PR is to allow users to integrate oneMath in their application with compile-time dispatching, only by linking against onemath__ targets. With the current CMake this would fail to compile due to missing include directories and linking libraries unless users manually add the dependencies or set up environment variables. This makes it easier for users.
To show this I have also updated the example's CMake to simplify them and make sure they only rely on
target_link_libraries
to get the oneMath library dependencies.For some more context about my motivation for this change:
Other changes:
onemath
.install(TARGETS ${LIB_OBJ} ...)
. These target pollute the outputted oneMathTargets.cmake file and end up requiring more CMake targets such as ONEMATH::cublas targets which are not useful to users. With these changes${LIB_NAME}
targets link${LIB_OBJ}
targets privately so it is not needed to install them anymore.These are only CMake changes so I think the review from onemath-arch-write is enough but more feedback is welcomed.
Checklist
All Submissions