mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[build] Add LeakSanitizer option to CMake (#158686)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158686 Approved by: https://github.com/eellison
This commit is contained in:
committed by
PyTorch MergeBot
parent
af60398c3a
commit
bdbe931d58
@ -108,24 +108,32 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_BUILD_MOBILE)
|
||||
enable_ubsan()
|
||||
endif()
|
||||
|
||||
if(USE_ASAN OR USE_TSAN)
|
||||
if(USE_ASAN OR USE_LSAN OR USE_TSAN)
|
||||
find_package(Sanitizer REQUIRED)
|
||||
if(USE_ASAN)
|
||||
if(TARGET Sanitizer::address)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::address)
|
||||
else()
|
||||
message(WARNING "Not ASAN found. Suppress this warning with -DUSE_ASAN=OFF.")
|
||||
message(WARNING "ASAN not found. Suppress this warning with -DUSE_ASAN=OFF.")
|
||||
caffe2_update_option(USE_ASAN OFF)
|
||||
endif()
|
||||
if(TARGET Sanitizer::undefined)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::undefined)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_LSAN)
|
||||
if(TARGET Sanitizer::leak)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::leak)
|
||||
else()
|
||||
message(WARNING "LSAN not found. Suppress this warning with -DUSE_LSAN=OFF.")
|
||||
caffe2_update_option(USE_LSAN OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_TSAN)
|
||||
if(TARGET Sanitizer::thread)
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS Sanitizer::thread)
|
||||
else()
|
||||
message(WARNING "Not TSAN found. Suppress this warning with -DUSE_TSAN=OFF.")
|
||||
message(WARNING "TSAN not found. Suppress this warning with -DUSE_TSAN=OFF.")
|
||||
caffe2_update_option(USE_TSAN OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -66,6 +66,7 @@ function(caffe2_print_configuration_summary)
|
||||
message(STATUS " LAPACK : ${LAPACK_INFO}")
|
||||
endif()
|
||||
message(STATUS " USE_ASAN : ${USE_ASAN}")
|
||||
message(STATUS " USE_LSAN : ${USE_LSAN}")
|
||||
message(STATUS " USE_TSAN : ${USE_TSAN}")
|
||||
message(STATUS " USE_CPP_CODE_COVERAGE : ${USE_CPP_CODE_COVERAGE}")
|
||||
message(STATUS " USE_CUDA : ${USE_CUDA}")
|
||||
|
Reference in New Issue
Block a user