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 (#12370)
Browse files Browse the repository at this point in the history
* Add ASAN sanitizer to CI

* [MXNET-953] Use gcc8 via cmake options

Use CMake to specify the compiler used for ASAN.  This is more portable
and doesn't rely on env vars.

* [MXNET-953] Don't fail build on leak detection

* [MXNET-953] Include deps required by scala test
  • Loading branch information
KellenSunderland authored and marcoabreu committed Sep 19, 2018
1 parent 96424b3 commit db295ef
Show file tree
Hide file tree
Showing 7 changed files with 149 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 db295ef

Please sign in to comment.