Skip to content

Commit 521848e

Browse files
authored
Link NVSHMEM to sublibraries as interface (#22)
Without this change `all_to_all_internode_lib`, `all_to_all_intranode_lib` and `core_lib` link NVSHMEM in such way that external variables of NVSHMEM have multiple instances, e.g.: ``` &nvshmemi_device_state = 0x7d5121b1fb20 nvshmemi_device_state.nvshmemi_is_nvshmem_initialized = 1 &nvshmemi_device_state = 0x7d511a7c22e0 nvshmemi_device_state.nvshmemi_is_nvshmem_initialized = 0 ``` which leads to unpredictable errors like: ``` NVSHMEM API called before NVSHMEM initialization has completed ```
1 parent 081394b commit 521848e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

csrc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ target_link_libraries(pplx_kernels PUBLIC
6868
Python::Module
6969
CUDA::cuda_driver
7070
CUDA::cudart
71-
nvshmem::nvshmem_host
71+
nvshmem::nvshmem
7272
)
7373
set_target_properties(pplx_kernels PROPERTIES
7474
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../src/pplx_kernels

csrc/all_to_all/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ add_library(all_to_all_intranode_lib STATIC
1515
)
1616
target_link_libraries(all_to_all_intranode_lib PUBLIC
1717
all_to_all_common
18-
nvshmem::nvshmem
1918
CUDA::cudart
2019
)
20+
target_link_libraries(all_to_all_intranode_lib INTERFACE
21+
nvshmem::nvshmem
22+
)
23+
target_include_directories(all_to_all_intranode_lib PRIVATE ${NVSHMEM_INCLUDE_DIR})
2124
set_cuda_compile_options(all_to_all_intranode_lib)
2225

2326
add_library(all_to_all_internode_lib STATIC
@@ -27,9 +30,12 @@ add_library(all_to_all_internode_lib STATIC
2730
)
2831
target_link_libraries(all_to_all_internode_lib PUBLIC
2932
all_to_all_common
30-
nvshmem::nvshmem
3133
CUDA::cudart
3234
)
35+
target_link_libraries(all_to_all_internode_lib INTERFACE
36+
nvshmem::nvshmem
37+
)
38+
target_include_directories(all_to_all_internode_lib PRIVATE ${NVSHMEM_INCLUDE_DIR})
3339
set_cuda_compile_options(all_to_all_internode_lib)
3440

3541
if(WITH_TESTS)

csrc/core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ add_library(core_lib STATIC
66
)
77
target_link_libraries(core_lib PUBLIC
88
CUDA::cudart
9+
)
10+
target_link_libraries(core_lib INTERFACE
911
nvshmem::nvshmem
1012
)
13+
target_include_directories(core_lib PRIVATE ${NVSHMEM_INCLUDE_DIR})
1114
set_cuda_compile_options(core_lib)

0 commit comments

Comments
 (0)