@@ -39,6 +39,10 @@ option(FAST_BUILD "Skip compiling some kernels to accelerate compiling" OFF)
39
39
option (FAST_MATH "Compiling in fast math mode" OFF )
40
40
option (INDEX_RANGE_CHECK "Compiling with index range checks" OFF )
41
41
option (COMPRESS_FATBIN "Compress everything in fatbin" ON )
42
+ option (ENABLE_MULTI_DEVICE
43
+ "Enable building with multi device support (requires NCCL, MPI,...)" ON )
44
+ option (ENABLE_UCX "Enable building with UCX (Uniform Communication X) support"
45
+ ON )
42
46
43
47
# Always use static NVRTC for IP protection reasons.
44
48
set (USE_SHARED_NVRTC OFF )
@@ -347,7 +351,6 @@ set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
347
351
348
352
find_library (RT_LIB rt)
349
353
350
- set_ifndef(ENABLE_MULTI_DEVICE 1)
351
354
if (ENABLE_MULTI_DEVICE)
352
355
# NCCL dependencies
353
356
set_ifndef(NCCL_LIB_DIR /usr/lib/${CMAKE_SYSTEM_PROCESSOR} -linux-gnu/)
@@ -438,9 +441,15 @@ endif()
438
441
439
442
# set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -G")
440
443
441
- set (CMAKE_CXX_FLAGS
442
- "${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss -DENABLE_MULTI_DEVICE=${ENABLE_MULTI_DEVICE} "
443
- )
444
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss " )
445
+
446
+ # note: cmake expr generation $<BOOL:${ENABLE_MULTI_DEVICE}> is a build time
447
+ # evaluation so hard to debug at cmake time
448
+ if (ENABLE_MULTI_DEVICE)
449
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MULTI_DEVICE=1" )
450
+ else ()
451
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MULTI_DEVICE=0" )
452
+ endif ()
444
453
445
454
# Fix linking issue with TRT 10, the detailed description about `--mcmodel` can
446
455
# be found in
@@ -653,7 +662,6 @@ endif()
653
662
654
663
# Defer UCX/UCXX setup until after USE_CXX11_ABI is well defined, as UCXX will
655
664
# need to be built to have aligned symbols
656
- set_ifndef(ENABLE_UCX 1)
657
665
if (ENABLE_UCX)
658
666
# Only enable UCX related features if the system has UCX library
659
667
find_package (ucx)
@@ -680,7 +688,11 @@ if(ENABLE_UCX)
680
688
NO_DEFAULT_PATH)
681
689
endif ()
682
690
endif ()
683
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_UCX=${ENABLE_UCX} " )
691
+ if (ENABLE_UCX)
692
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_UCX=1" )
693
+ else ()
694
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_UCX=0" )
695
+ endif ()
684
696
685
697
file (STRINGS "${TRT_INCLUDE_DIR} /NvInferVersion.h" VERSION_STRINGS
686
698
REGEX "#define NV_TENSORRT_.*" )
0 commit comments