mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[CMake] [3/N] Remove unused code (#130322)
Some functions used by Caffe2 were removed along with some outdated checks. Follows #130006. Pull Request resolved: https://github.com/pytorch/pytorch/pull/130322 Approved by: https://github.com/r-barnes
This commit is contained in:
parent
3477ee38e4
commit
a6345d3477
|
|
@ -750,7 +750,6 @@ if(NOT TORCH_BUILD_VERSION)
|
||||||
CACHE STRING "Torch build version" FORCE)
|
CACHE STRING "Torch build version" FORCE)
|
||||||
endif()
|
endif()
|
||||||
caffe2_parse_version_str(TORCH ${TORCH_BUILD_VERSION})
|
caffe2_parse_version_str(TORCH ${TORCH_BUILD_VERSION})
|
||||||
caffe2_parse_version_str(CAFFE2 ${TORCH_BUILD_VERSION})
|
|
||||||
set(TORCH_SOVERSION "${TORCH_VERSION_MAJOR}.${TORCH_VERSION_MINOR}")
|
set(TORCH_SOVERSION "${TORCH_VERSION_MAJOR}.${TORCH_VERSION_MINOR}")
|
||||||
|
|
||||||
# ---[ CMake scripts + modules
|
# ---[ CMake scripts + modules
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ endif()
|
||||||
|
|
||||||
# ---[ ATen build
|
# ---[ ATen build
|
||||||
if(INTERN_BUILD_ATEN_OPS)
|
if(INTERN_BUILD_ATEN_OPS)
|
||||||
set(__caffe2_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
set(__torch_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
add_subdirectory(../aten aten)
|
add_subdirectory(../aten aten)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ${__caffe2_CMAKE_POSITION_INDEPENDENT_CODE})
|
set(CMAKE_POSITION_INDEPENDENT_CODE ${__torch_CMAKE_POSITION_INDEPENDENT_CODE})
|
||||||
|
|
||||||
# Generate the headers wrapped by our operator
|
# Generate the headers wrapped by our operator
|
||||||
file(GLOB_RECURSE torchgen_python "${PROJECT_SOURCE_DIR}/torchgen/*.py")
|
file(GLOB_RECURSE torchgen_python "${PROJECT_SOURCE_DIR}/torchgen/*.py")
|
||||||
|
|
|
||||||
|
|
@ -1358,9 +1358,7 @@ if(NOT INTERN_BUILD_MOBILE)
|
||||||
|
|
||||||
# use cub in a safe manner, see:
|
# use cub in a safe manner, see:
|
||||||
# https://github.com/pytorch/pytorch/pull/55292
|
# https://github.com/pytorch/pytorch/pull/55292
|
||||||
if(NOT ${CUDA_VERSION} LESS 11.5)
|
|
||||||
string(APPEND CMAKE_CUDA_FLAGS " -DCUB_WRAPPED_NAMESPACE=at_cuda_detail")
|
string(APPEND CMAKE_CUDA_FLAGS " -DCUB_WRAPPED_NAMESPACE=at_cuda_detail")
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Found CUDA with FP16 support, compiling with torch.cuda.HalfTensor")
|
message(STATUS "Found CUDA with FP16 support, compiling with torch.cuda.HalfTensor")
|
||||||
string(APPEND CMAKE_CUDA_FLAGS " -DCUDA_HAS_FP16=1"
|
string(APPEND CMAKE_CUDA_FLAGS " -DCUDA_HAS_FP16=1"
|
||||||
|
|
@ -1430,11 +1428,6 @@ if(NOT INTERN_BUILD_MOBILE)
|
||||||
add_compile_options(-mcpu=cortex-a9)
|
add_compile_options(-mcpu=cortex-a9)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND NOT CYGWIN)
|
|
||||||
set(BLAS_INSTALL_LIBRARIES "OFF"
|
|
||||||
CACHE BOOL "Copy the required BLAS DLLs into the TH install dirs")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(LAPACK)
|
find_package(LAPACK)
|
||||||
if(LAPACK_FOUND)
|
if(LAPACK_FOUND)
|
||||||
set(USE_LAPACK 1)
|
set(USE_LAPACK 1)
|
||||||
|
|
|
||||||
|
|
@ -16,71 +16,6 @@ endforeach()
|
||||||
set(${OUTPUT} ${OUT} PARENT_SCOPE)
|
set(${OUTPUT} ${OUT} PARENT_SCOPE)
|
||||||
endfunction(prepend)
|
endfunction(prepend)
|
||||||
|
|
||||||
|
|
||||||
################################################################################################
|
|
||||||
# Clears variables from list
|
|
||||||
# Usage:
|
|
||||||
# caffe_clear_vars(<variables_list>)
|
|
||||||
macro(caffe_clear_vars)
|
|
||||||
foreach(_var ${ARGN})
|
|
||||||
unset(${_var})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
################################################################################################
|
|
||||||
# Prints list element per line
|
|
||||||
# Usage:
|
|
||||||
# caffe_print_list(<list>)
|
|
||||||
function(caffe_print_list)
|
|
||||||
foreach(e ${ARGN})
|
|
||||||
message(STATUS ${e})
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
################################################################################################
|
|
||||||
# Reads set of version defines from the header file
|
|
||||||
# Usage:
|
|
||||||
# caffe_parse_header(<file> <define1> <define2> <define3> ..)
|
|
||||||
macro(caffe_parse_header FILENAME FILE_VAR)
|
|
||||||
set(vars_regex "")
|
|
||||||
set(__parnet_scope OFF)
|
|
||||||
set(__add_cache OFF)
|
|
||||||
foreach(name ${ARGN})
|
|
||||||
if("${name}" STREQUAL "PARENT_SCOPE")
|
|
||||||
set(__parnet_scope ON)
|
|
||||||
elseif("${name}" STREQUAL "CACHE")
|
|
||||||
set(__add_cache ON)
|
|
||||||
elseif(vars_regex)
|
|
||||||
set(vars_regex "${vars_regex}|${name}")
|
|
||||||
else()
|
|
||||||
set(vars_regex "${name}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(EXISTS "${FILENAME}")
|
|
||||||
file(STRINGS "${FILENAME}" ${FILE_VAR} REGEX "#define[ \t]+(${vars_regex})[ \t]+[0-9]+" )
|
|
||||||
else()
|
|
||||||
unset(${FILE_VAR})
|
|
||||||
endif()
|
|
||||||
foreach(name ${ARGN})
|
|
||||||
if(NOT "${name}" STREQUAL "PARENT_SCOPE" AND NOT "${name}" STREQUAL "CACHE")
|
|
||||||
if(${FILE_VAR})
|
|
||||||
if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
|
|
||||||
string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
|
|
||||||
else()
|
|
||||||
set(${name} "")
|
|
||||||
endif()
|
|
||||||
if(__add_cache)
|
|
||||||
set(${name} ${${name}} CACHE INTERNAL "${name} parsed from ${FILENAME}" FORCE)
|
|
||||||
elseif(__parnet_scope)
|
|
||||||
set(${name} "${${name}}" PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
unset(${name} CACHE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
################################################################################################
|
################################################################################################
|
||||||
# Parses a version string that might have values beyond major, minor, and patch
|
# Parses a version string that might have values beyond major, minor, and patch
|
||||||
# and set version variables for the library.
|
# and set version variables for the library.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user