Commit f91da82e authored by Sebastian Woelke's avatar Sebastian Woelke

Add support for tcmalloc

parent 0afd7caf
...@@ -81,6 +81,10 @@ if(NOT CAF_NO_HWLOC) ...@@ -81,6 +81,10 @@ if(NOT CAF_NO_HWLOC)
set(CAF_NO_HWLOC no) set(CAF_NO_HWLOC no)
endif() endif()
if(NOT CAF_NO_TCMALLOC)
set(CAF_NO_TCMALLOC no)
endif()
if(NOT CAF_NO_PYTHON) if(NOT CAF_NO_PYTHON)
set(CAF_NO_PYTHON no) set(CAF_NO_PYTHON no)
endif() endif()
...@@ -286,6 +290,19 @@ if(NOT CAF_NO_HWLOC) ...@@ -286,6 +290,19 @@ if(NOT CAF_NO_HWLOC)
set(CAF_NO_HWLOC yes) set(CAF_NO_HWLOC yes)
endif() endif()
endif() endif()
# load tcmalloc library if not told otherwise
if(NOT CAF_NO_TCMALLOC)
find_package(Tcmalloc)
if(Tcmalloc_FOUND)
set(LD_FLAGS ${LD_FLAGS} ${Tcmalloc_LIBRARIES})
# load gperf cpuprofiler if configured
if(CAF_GPERF_CPUPROFILER)
set(LD_FLAGS "${LD_FLAGS} -lprofiler")
endif()
else()
set(CAF_NO_TCMALLOC yes)
endif()
endif()
# -fPIC generates warnings on MinGW and Cygwin plus extra setup steps needed on MinGW # -fPIC generates warnings on MinGW and Cygwin plus extra setup steps needed on MinGW
if(MINGW) if(MINGW)
add_definitions(-D_WIN32_WINNT=0x0600) add_definitions(-D_WIN32_WINNT=0x0600)
...@@ -355,6 +372,7 @@ macro(to_int_value name) ...@@ -355,6 +372,7 @@ macro(to_int_value name)
endmacro() endmacro()
to_int_value(CAF_NO_HWLOC) to_int_value(CAF_NO_HWLOC)
to_int_value(CAF_NO_TCMALLOC)
to_int_value(CAF_LOG_LEVEL) to_int_value(CAF_LOG_LEVEL)
to_int_value(CAF_NO_EXCEPTIONS) to_int_value(CAF_NO_EXCEPTIONS)
to_int_value(CAF_NO_MEM_MANAGEMENT) to_int_value(CAF_NO_MEM_MANAGEMENT)
...@@ -700,6 +718,7 @@ invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT) ...@@ -700,6 +718,7 @@ invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT)
invertYesNo(CAF_NO_BENCHMARKS CAF_BUILD_BENCHMARKS) invertYesNo(CAF_NO_BENCHMARKS CAF_BUILD_BENCHMARKS)
invertYesNo(CAF_NO_OPENCL CAF_BUILD_OPENCL) invertYesNo(CAF_NO_OPENCL CAF_BUILD_OPENCL)
invertYesNo(CAF_NO_HWLOC CAF_BUILD_HWLOC) invertYesNo(CAF_NO_HWLOC CAF_BUILD_HWLOC)
invertYesNo(CAF_NO_TCMALLOC CAF_BUILD_TCMALLOC)
invertYesNo(CAF_NO_PYTHON CAF_BUILD_PYTHON) invertYesNo(CAF_NO_PYTHON CAF_BUILD_PYTHON)
# collect all compiler flags # collect all compiler flags
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
...@@ -726,6 +745,7 @@ if(NOT CAF_NO_SUMMARY) ...@@ -726,6 +745,7 @@ if(NOT CAF_NO_SUMMARY)
"\nBuild benchmarks: ${CAF_BUILD_BENCHMARKS}" "\nBuild benchmarks: ${CAF_BUILD_BENCHMARKS}"
"\nBuild opencl: ${CAF_BUILD_OPENCL}" "\nBuild opencl: ${CAF_BUILD_OPENCL}"
"\nBuild hwloc: ${CAF_BUILD_HWLOC}" "\nBuild hwloc: ${CAF_BUILD_HWLOC}"
"\nBuild tcmalloc: ${CAF_BUILD_TCMALLOC}"
"\nBuild Python: ${CAF_BUILD_PYTHON}" "\nBuild Python: ${CAF_BUILD_PYTHON}"
"\n" "\n"
"\nCXX: ${CMAKE_CXX_COMPILER}" "\nCXX: ${CMAKE_CXX_COMPILER}"
......
# - 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 NO_DEFAULT_PATH PATHS
${HT_DEPENDENCY_INCLUDE_DIR}
/usr/include
/opt/local/include
/usr/local/include
)
set(Tcmalloc_NAMES tcmalloc)
find_library(Tcmalloc_LIBRARY NO_DEFAULT_PATH
NAMES ${Tcmalloc_NAMES}
PATHS ${HT_DEPENDENCY_LIB_DIR} /lib /usr/lib /usr/local/lib /opt/local/lib
)
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: ${Tcmalloc_LIBRARY}")
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
)
...@@ -66,6 +66,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -66,6 +66,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--no-unit-tests build without unit tests --no-unit-tests build without unit tests
--no-opencl build without OpenCL module --no-opencl build without OpenCL module
--no-hwloc build without NUMA related optimizations --no-hwloc build without NUMA related optimizations
--no-tcmalloc build without tcmalloc
--no-benchmarks build without benchmarks --no-benchmarks build without benchmarks
--no-tools build without CAF tools such as caf-run --no-tools build without CAF tools such as caf-run
--no-io build without I/O module --no-io build without I/O module
...@@ -85,6 +86,9 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -85,6 +86,9 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
- TRACE - TRACE
--with-address-sanitizer build with address sanitizer if available --with-address-sanitizer build with address sanitizer if available
--with-gcov build with gcov coverage enabled --with-gcov build with gcov coverage enabled
--with-gperf-cpuprofiler build with cpu profiler (requires environment variable
CPUPROFILE=/path/to/output/file/prof.out
on start up for)
Influential Environment Variables (only on first invocation): Influential Environment Variables (only on first invocation):
CXX C++ compiler command CXX C++ compiler command
...@@ -343,6 +347,12 @@ while [ $# -ne 0 ]; do ...@@ -343,6 +347,12 @@ while [ $# -ne 0 ]; do
--no-hwloc) --no-hwloc)
append_cache_entry CAF_NO_HWLOC BOOL yes append_cache_entry CAF_NO_HWLOC BOOL yes
;; ;;
--no-tcmalloc)
append_cache_entry CAF_NO_TCMALLOC BOOL yes
;;
--with-gperf-cpuprofiler)
append_cache_entry CAF_GPERF_CPUPROFILER BOOL yes
;;
--build-static) --build-static)
append_cache_entry CAF_BUILD_STATIC BOOL yes append_cache_entry CAF_BUILD_STATIC BOOL yes
;; ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment