Add Numa support (#2152)

This commit is contained in:
Yangqing Jia 2018-03-05 23:30:20 -08:00 committed by Dmytro Dzhulgakov
parent 115579697e
commit 4aded2f7c1
3 changed files with 47 additions and 0 deletions

View file

@ -53,6 +53,7 @@ option(USE_NCCL "Use NCCL" ON)
option(USE_NERVANA_GPU "Use Nervana GPU backend" OFF)
option(USE_NNAPI "Use NNAPI" OFF)
option(USE_NNPACK "Use NNPACK" ON)
option(USE_NUMA "Use NUMA (only available on Linux)" ON)
option(USE_OBSERVERS "Use Observer Library" OFF)
option(USE_OPENCV "Use openCV" ON)
option(USE_OPENMP "Use OpenMP for parallel code" OFF)

View file

@ -181,6 +181,23 @@ if(USE_LEVELDB)
endif()
endif()
# ---[ NUMA
if(USE_NUMA)
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING "NUMA is currently only supported under Linux.")
set(USE_NUMA OFF)
else()
find_package(Numa)
if(NUMA_FOUND)
include_directories(${Numa_INCLUDE_DIR})
list(APPEND Caffe2_DEPENDENCY_LIBS ${Numa_LIBRARIES})
else()
message(WARNING "Not compiling with NUMA. Suppress this warning with -DUSE_NUMA=OFF")
set(USE_NUMA OFF)
endif()
endif()
endif()
# ---[ ZMQ
if(USE_ZMQ)
find_package(ZMQ)

View file

@ -0,0 +1,29 @@
# Find the Numa libraries
#
# The following variables are optionally searched for defaults
# NUMA_ROOT_DIR: Base directory where all Numa components are found
#
# The following are set after configuration is done:
# NUMA_FOUND
# Numa_INCLUDE_DIR
# Numa_LIBRARIES
find_path(
Numa_INCLUDE_DIR NAMES numa.h
PATHS ${NUMA_ROOT_DIR} ${NUMA_ROOT_DIR}/include)
find_library(
Numa_LIBRARIES NAMES numa
PATHS ${NUMA_ROOT_DIR} ${NUMA_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Numa DEFAULT_MSG Numa_INCLUDE_DIR Numa_LIBRARIES)
if(NUMA_FOUND)
message(
STATUS
"Found Numa (include: ${Numa_INCLUDE_DIR}, library: ${Numa_LIBRARIES})")
mark_as_advanced(Numa_INCLUDE_DIR Numa_LIBRARIES)
endif()