cutlass icon indicating copy to clipboard operation
cutlass copied to clipboard

[BUG] CMake transitive target doesn't appear to work

Open cliffburdick opened this issue 3 years ago • 4 comments

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

cliffburdick avatar Mar 16 '22 15:03 cliffburdick

@d-k-b

hwu36 avatar Mar 16 '22 16:03 hwu36

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.

github-actions[bot] avatar Apr 15 '22 20:04 github-actions[bot]

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.

github-actions[bot] avatar Jul 19 '22 22:07 github-actions[bot]

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?

GammaPi avatar Sep 09 '22 02:09 GammaPi

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.

github-actions[bot] avatar Oct 09 '22 03:10 github-actions[bot]

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.

github-actions[bot] avatar Jan 10 '23 18:01 github-actions[bot]

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.

d-k-b avatar Jan 11 '23 14:01 d-k-b