Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[MXNET-953] - Add ASAN sanitizer, Enable in CI
Browse files Browse the repository at this point in the history
This adds an ASAN sanitizer option to MXNet.  Turn on with -DUSE_ASAN.
It also adds some basic ASAN testing in CI, currently for reference only.
  • Loading branch information
KellenSunderland committed Sep 14, 2018
1 parent 4ee866f commit 039e1aa
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 90 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mxnet_option(BUILD_CPP_EXAMPLES "Build cpp examples" ON)
mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF)
mxnet_option(USE_SIGNAL_HANDLER "Print stack traces on segfaults." OFF)
mxnet_option(USE_TENSORRT "Enable infeference optimization with TensorRT." OFF)
mxnet_option(USE_ASAN "Enable Clang/GCC ASAN sanitizers." OFF)

message(STATUS "CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}")
if(USE_CUDA AND NOT USE_OLDCMAKECUDA)
Expand Down Expand Up @@ -285,6 +286,14 @@ else()
endif()
endif()

if(USE_ASAN)
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
set(GTEST_LIBRARIES "${GTEST_LIBRARIES} -fsanitize=address")
list(APPEND mxnet_LINKER_LIBS asan)
endif()

list(APPEND mxnet_LINKER_LIBS ${mshadow_LINKER_LIBS})

foreach(var ${C_CXX_INCLUDE_DIRECTORIES})
Expand Down
Loading

0 comments on commit 039e1aa

Please sign in to comment.