Skip to content

Commit fa0dd59

Browse files
authored
Adding libtorch_nvshmem.so (#162)
* Adding libtorch_nvshmem.so * change: CPU only build doesn't have CUDA_VERSION environment variable. Using flag to control library inclusion. * Removing generation expression
1 parent abafeb6 commit fa0dd59

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ option(TRITON_ENABLE_STATS "Include statistics collections in backend" ON)
5050
option(TRITON_ENABLE_NVTX "Include nvtx markers collection in backend." OFF)
5151
option(TRITON_PYTORCH_ENABLE_TORCHTRT "Enable TorchTRT support" OFF)
5252
option(TRITON_PYTORCH_ENABLE_TORCHVISION "Enable Torchvision support" ON)
53+
option(TRITON_PYTORCH_NVSHMEM "Enable NVSHMEM support" ON)
5354

5455
set(TRITON_PYTORCH_DOCKER_IMAGE "" CACHE STRING "Docker image containing the PyTorch build required by backend.")
5556
set(TRITON_PYTORCH_INCLUDE_PATHS "" CACHE PATH "Paths to Torch includes")
@@ -162,6 +163,13 @@ set(PT_LIBS
162163
"libjpeg.so.62"
163164
)
164165

166+
if (${TRITON_PYTORCH_NVSHMEM})
167+
set(PT_LIBS
168+
${PT_LIBS}
169+
"libtorch_nvshmem.so"
170+
)
171+
endif() # TRITON_PYTORCH_NVSHMEM
172+
165173
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
166174
set(PT_LIBS
167175
${PT_LIBS}
@@ -238,6 +246,7 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
238246
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libtorch_cuda_linalg.so libtorch_cuda_linalg.so
239247
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libtorch_global_deps.so libtorch_global_deps.so
240248
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libcaffe2_nvrtc.so libcaffe2_nvrtc.so
249+
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_NVSHMEM} = 'ON' ]; then docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libtorch_nvshmem.so libtorch_nvshmem.so; fi"
241250
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then if [ ${RHEL_BUILD} = 'ON' ]; then docker cp -a -L pytorch_backend_ptlib:/usr/local/lib64/libtorchvision.so libtorchvision.so; else docker cp -a -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libtorchvision.so.1 libtorchvision.so.1; fi; fi"
242251
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then docker cp pytorch_backend_ptlib:/opt/pytorch/vision/torchvision/csrc include/torchvision/torchvision; fi"
243252
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:/usr/local/lib/python3.12/dist-packages/torch_tensorrt/lib/libtorchtrt_runtime.so libtorchtrt_runtime.so; fi"

0 commit comments

Comments
 (0)