-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Recommended way for using this in a project? #266
Comments
I assume you need the NVTX wrappers as well, since - if you do not, then the runtime-API library is just header-only, and you don't need that But regardless - that's not how you want to use one CMake project in another one. This doesn't carry dependencies; nor does it let you apply library version constraints; nor allow the user to replace the library version they're using (e.g. to use the cuda-api-wrappers version they've installed on their system). The idiomatic way, given project proj_a exporting target proj_a::tgt and project proj_b is to do the following:
|
I trust this answers your question. |
Hi @eyalroz, sorry for the late reply. Your answer was more than exhaustive, thanks :) |
Hi, thank you for this amazing work. I can build and run the examples successfully and smoothly.
I'm wondering what is the recommended way for using this library in a separate CMake project. Assume to have a folder structure as follows:
src
|_ main.cu
|_ cuda
where cuda is your code and main.cu anything you want (e.g. the vector addition program). I can build this by appending the following two lines to your CMakeLists.txt:
add_executable(test src/main.cu)
target_link_libraries(test runtime-api)
What I would like to do is to get rid of your long CMakeLists.txt and just link the static library libcuda-nvtx-wrappers.a that is generated. Something like this:
cmake_minimum_required(VERSION 3.17)
project(test LANGUAGES CUDA CXX)
add_executable(test src/main.cu)
target_link_libraries(test /path/to/libcuda-nvtx-wrappers.a)
This naive solution results in a "no such file or directory" for "<cuda/runtime_api.hpp>". How would I do that? Would you consider adding a MWE (Minimal Working Example) in the Readme? I think this would help other users as well.
Thank you in advance!
The text was updated successfully, but these errors were encountered: