Skip to content

Commit 77158d4

Browse files
committed
make IMPORTED rocshmem library
1 parent 14d7b51 commit 77158d4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

transformer_engine/common/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,23 @@ else()
395395
else()
396396
set(ROCSHMEM_HOME "/opt/rocm" CACHE STRING "Location of ROCSHMEM installation (default)")
397397
endif()
398+
set(ROCSHMEM_LIBRARY_PATH "${ROCSHMEM_HOME}/lib/librocshmem.a")
399+
if (EXISTS ${ROCSHMEM_LIBRARY_PATH})
400+
add_library(rocshmem STATIC IMPORTED)
401+
set_target_properties(rocshmem PROPERTIES
402+
IMPORTED_LOCATION "${ROCSHMEM_LIBRARY_PATH}"
403+
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
404+
)
405+
else()
406+
message(FATAL_ERROR "ROCSHMEM library not found at ${ROCSHMEM_LIBRARY_PATH}. PLease set ROCSHMEM_HOME.")
407+
endif()
398408
target_link_options(transformer_engine PRIVATE
399409
-fgpu-rdc
400410
)
401411
target_link_libraries(transformer_engine PUBLIC
402412
-Wl,--whole-archive
403413
rocshmemapi
404-
"${ROCSHMEM_HOME}/lib/librocshmem.a"
414+
rocshmem
405415
-Wl,--no-whole-archive
406416
)
407417
endif()

0 commit comments

Comments
 (0)