cutlass
cutlass copied to clipboard
[BUG] CMake transitive target doesn't appear to work
Describe the bug
After using add_subdirectory on CUTLASS in a CMake project, I'd expect CUTLASS's transitive target(s) to be exported for use in other projects. I have tried the following targets:
nvidia::cutlass::CUTLASS
nvidia::cutlass::cutlass
nvidia::cutlass
nvidia::CUTLASS
but all of them produce the error:
links to target "nvidia::cutlass::CUTLASS" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
Steps/Code to reproduce bug
Import cutlass using add_subdirectory and try to use transitive targets inside of target_link_libraries.
Expected behavior Includes and libraries would be populated
Environment details (please complete the following information): Ubuntu 20.04 CUTLASS 2.8.0
- Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)] Container
@d-k-b
This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.
This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.
add_library(CUTLASS INTERFACE)
add_library(nvidia::cutlass::cutlass ALIAS CUTLASS)
set_target_properties(CUTLASS PROPERTIES EXPORT_NAME cutlass)
It looks like you should use CUTLASS?
This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.
This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.
Hey @cliffburdick, I finally got around to fixing and cleaning up some of the CUTLASS CMake code. I tested this out and it worked fine for me using CMake 3.18.
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(cutlass_import_example VERSION 0.1 LANGUAGES CXX CUDA)
add_subdirectory(${CUTLASS_DIR} ${CMAKE_CURRENT_BINARY_DIR}/cutlass)
add_executable(example)
target_sources(example PRIVATE main.cpp)
target_include_directories(
example
PRIVATE
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)
target_link_libraries(
example
PRIVATE
nvidia::cutlass::cutlass
nvidia::cutlass::library
)
The build included the proper CUTLASS headers and linked with the CUTLASS library. One thing to note, you need to use nvidia::cutlass::cutlass as the alias, as CMake is case-sensitive. If I use nvidia::cutlass::CUTLASS, I see the same error you showed in the description.