Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions cpp/tensorrt_llm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ add_subdirectory(runtime)
add_subdirectory(testing)
add_subdirectory(executor_worker)

if(ENABLE_CUFILE)
find_library(
CUFILE_LIBRARY cufile HINTS ${CUDAToolkit_LIBRARY_DIR}
/usr/lib/${TARGET_ARCH} /usr/local/lib)
if(NOT CUFILE_LIBRARY)
# FATAL_ERROR if user explicitly requests with GDS if CUDA's libcufile.so is
# not found.
message(
FATAL_ERROR
"cuFile library not found. Set -DENABLE_CUFILE=OFF if cufile isn't required."
)
else()
message(STATUS "Linking with cufile: ${CUFILE_LIBRARY}")
endif()
else()
message(STATUS "ENABLE_CUFILE=OFF, skipping GDS linkage.")
endif()

set(BATCH_MANAGER_TARGET tensorrt_llm_batch_manager_static)
set(BATCH_MANAGER_TARGET_ARCH ${TARGET_ARCH})
add_subdirectory(batch_manager)
Expand Down Expand Up @@ -209,32 +227,17 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

add_library(${SHARED_TARGET} SHARED)

if(ENABLE_CUFILE)
find_library(
CUFILE_LIBRARY cufile HINTS /usr/local/cuda-12.6/targets/x86_64-linux/lib
/usr/lib/x86_64-linux-gnu /usr/local/lib)
if(NOT CUFILE_LIBRARY)
# FATAL_ERROR if user explicitly requests with GDS if CUDA's libcufile.so is
# not found.
message(
FATAL_ERROR
"cuFile library not found. Set -DENABLE_CUFILE=OFF if cufile isn't required."
)
else()
message(STATUS "Linking with cufile: ${CUFILE_LIBRARY}")
target_link_libraries(${SHARED_TARGET} PUBLIC ${CUFILE_LIBRARY})
endif()
else()
message(STATUS "ENABLE_CUFILE=OFF, skipping GDS linkage.")
endif()

set_target_properties(
${SHARED_TARGET}
PROPERTIES CXX_STANDARD "17" CXX_STANDARD_REQUIRED "YES" CXX_EXTENSIONS "NO"
LINK_FLAGS "${AS_NEEDED_FLAG} ${UNDEFINED_FLAG}")

target_link_libraries(${SHARED_TARGET} PUBLIC ${TRTLLM_LINK_LIBS})

if(ENABLE_CUFILE)
target_link_libraries(${SHARED_TARGET} PUBLIC ${CUFILE_LIBRARY})
endif()

target_link_libraries(
${SHARED_TARGET}
PRIVATE $<LINK_LIBRARY:WHOLE_ARCHIVE,${BATCH_MANAGER_TARGET}>
Expand Down
9 changes: 0 additions & 9 deletions cpp/tensorrt_llm/batch_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,7 @@ set(TOP_LEVEL_DIR "${PROJECT_SOURCE_DIR}/..")
target_compile_definitions(${BATCH_MANAGER_STATIC_TARGET}
PUBLIC TOP_LEVEL_DIR="${TOP_LEVEL_DIR}")

# Find and link cuFile library for kvCacheTransferManager (GDS).
if(ENABLE_CUFILE)
find_library(
CUFILE_LIBRARY
NAMES cufile
HINTS /usr/local/cuda-12.6/targets/x86_64-linux/lib
/usr/lib/x86_64-linux-gnu /usr/local/lib)
if(NOT CUFILE_LIBRARY)
message(FATAL_ERROR "Could not find cufile library inside container.")
endif()
target_link_libraries(${BATCH_MANAGER_STATIC_TARGET} PUBLIC ${CUFILE_LIBRARY})
endif()

Expand Down