mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-03 20:13:47 +03:00
Add TCMalloc
This commit is contained in:
parent
c31cb1e450
commit
a3b72c2ffe
@ -49,12 +49,20 @@ if(USE_CUDNN)
|
||||
endif(CUDNN_FOUND)
|
||||
endif(USE_CUDNN)
|
||||
|
||||
find_package(Tcmalloc)
|
||||
if(Tcmalloc_FOUND)
|
||||
include_directories(${Tcmalloc_INCLUDE_DIR})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${Tcmalloc_LIBRARIES})
|
||||
else(Tcmalloc_FOUND)
|
||||
message(WARNING "Cannot find TCMalloc library. Continuing.")
|
||||
endif(Tcmalloc_FOUND)
|
||||
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
set(EXT_LIBS ${EXT_LIBS} ${ZLIB_LIBRARIES})
|
||||
else(ZLIB_FOUND)
|
||||
message(SEND_ERROR "Cannot find zlib" )
|
||||
message(SEND_ERROR "Cannot find zlib.")
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
set(BOOST_COMPONENTS system timer iostreams filesystem chrono program_options thread)
|
||||
|
39
cmake/FindTcmalloc.cmake
Normal file
39
cmake/FindTcmalloc.cmake
Normal file
@ -0,0 +1,39 @@
|
||||
# - Find Tcmalloc
|
||||
# Find the native Tcmalloc includes and library
|
||||
#
|
||||
# Tcmalloc_INCLUDE_DIR - where to find Tcmalloc.h, etc.
|
||||
# Tcmalloc_LIBRARIES - List of libraries when using Tcmalloc.
|
||||
# Tcmalloc_FOUND - True if Tcmalloc found.
|
||||
|
||||
find_path(Tcmalloc_INCLUDE_DIR google/tcmalloc.h)
|
||||
|
||||
if (USE_TCMALLOC)
|
||||
set(Tcmalloc_NAMES tcmalloc)
|
||||
else ()
|
||||
set(Tcmalloc_NAMES tcmalloc_minimal tcmalloc)
|
||||
endif ()
|
||||
|
||||
find_library(Tcmalloc_LIBRARY NAMES ${Tcmalloc_NAMES})
|
||||
|
||||
if (Tcmalloc_INCLUDE_DIR AND Tcmalloc_LIBRARY)
|
||||
set(Tcmalloc_FOUND TRUE)
|
||||
set( Tcmalloc_LIBRARIES ${Tcmalloc_LIBRARY} )
|
||||
else ()
|
||||
set(Tcmalloc_FOUND FALSE)
|
||||
set( Tcmalloc_LIBRARIES )
|
||||
endif ()
|
||||
|
||||
if (Tcmalloc_FOUND)
|
||||
message(STATUS "Found Tcmalloc: ${Tcmalloc_LIBRARY}")
|
||||
else ()
|
||||
message(STATUS "Not Found Tcmalloc")
|
||||
if (Tcmalloc_FIND_REQUIRED)
|
||||
message(STATUS "Looked for Tcmalloc libraries named ${Tcmalloc_NAMES}.")
|
||||
message(FATAL_ERROR "Could NOT find Tcmalloc library")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(
|
||||
Tcmalloc_LIBRARY
|
||||
Tcmalloc_INCLUDE_DIR
|
||||
)
|
Loading…
Reference in New Issue
Block a user