Add USE_NAMEDTENSOR compilation flag. (#20162)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20162
ghimport-source-id: 0efcd67f04aa087e1dd5faeee550daa2f13ef1a5

Reviewed By: gchanan

Differential Revision: D15278211

Pulled By: zou3519

fbshipit-source-id: 6fee981915d83e820fe8b50a8f59da22a428a9bf
This commit is contained in:
Richard Zou
2019-05-09 09:05:14 -07:00
committed by Facebook Github Bot
parent f23fb66e6e
commit e01a5bf28b
5 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,7 @@ cmake_dependent_option(
USE_CUDNN "Use cuDNN" ON
"USE_CUDA" OFF)
option(USE_FBGEMM "Use FBGEMM (quantized 8-bit server operators)" OFF)
option(NAMEDTENSOR_ENABLED "Experimental: compile with namedtensor support" OFF)
option(USE_FFMPEG "Use ffmpeg" OFF)
option(USE_GFLAGS "Use GFLAGS" OFF)
option(USE_GLOG "Use GLOG" OFF)
@ -263,6 +264,10 @@ if(USE_FBGEMM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_FBGEMM")
endif()
if(NAMEDTENSOR_ENABLED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNAMEDTENSOR_ENABLED")
endif()
# ---[ Whitelist file if whitelist is specified
include(cmake/Whitelist.cmake)

View File

@ -80,4 +80,5 @@ static_assert(
{"USE_NVTX", "${CAFFE2_USE_NVTX}"}, \
{"USE_TRT", "${CAFFE2_USE_TRT}"}, \
{"DISABLE_NUMA", "${CAFFE2_DISABLE_NUMA}"}, \
{"NAMEDTENSOR_ENABLED", "${NAMEDTENSOR_ENABLED}"}, \
}

View File

@ -125,6 +125,7 @@ function (caffe2_print_configuration_summary)
message(STATUS " USE_GLOO : ${USE_GLOO}")
message(STATUS " USE_GLOO_IBVERBS : ${USE_GLOO_IBVERBS}")
endif()
message(STATUS " NAMEDTENSOR_ENABLED : ${NAMEDTENSOR_ENABLED}")
message(STATUS " Public Dependencies : ${Caffe2_PUBLIC_DEPENDENCY_LIBS}")
message(STATUS " Private Dependencies : ${Caffe2_DEPENDENCY_LIBS}")

View File

@ -175,6 +175,7 @@ def run_cmake(version,
USE_CUDA=USE_CUDA,
USE_DISTRIBUTED=USE_DISTRIBUTED,
USE_FBGEMM=not (check_env_flag('NO_FBGEMM') or check_negative_env_flag('USE_FBGEMM')),
NAMEDTENSOR_ENABLED=(check_env_flag('USE_NAMEDTENSOR') or check_negative_env_flag('NO_NAMEDTENSOR')),
USE_NUMPY=USE_NUMPY,
NUMPY_INCLUDE_DIR=escape_path(NUMPY_INCLUDE_DIR),
USE_SYSTEM_NCCL=USE_SYSTEM_NCCL,

View File

@ -61,3 +61,4 @@ hotpatch_build_env_vars()
DEBUG = check_env_flag('DEBUG')
REL_WITH_DEB_INFO = check_env_flag('REL_WITH_DEB_INFO')
USE_MKLDNN = check_env_flag('USE_MKLDNN', 'OFF' if IS_PPC or IS_ARM else 'ON')
NAMEDTENSOR_ENABLED = check_env_flag('USE_NAMEDTENSOR') or check_negative_env_flag('NO_NAMEDTENSOR')