mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/61311 Pull Request resolved: https://github.com/pytorch/pytorch/pull/61152 Some related docs about `submodule.fetchJobs` https://git-scm.com/docs/git-config#Documentation/git-config.txt-submodulefetchJobs ``` time git submodule update --init --recursive ________________________________________________________ Executed in 243.20 secs fish external usr time 49.64 secs 213.00 micros 49.64 secs sys time 29.27 secs 795.00 micros 29.27 secs ``` ``` time git submodule update --init --recursive --jobs 4 ________________________________________________________ Executed in 143.04 secs fish external usr time 51.06 secs 246.00 micros 51.06 secs sys time 30.96 secs 742.00 micros 30.96 secs ``` ``` time git submodule update --init --recursive --jobs 8 ________________________________________________________ Executed in 124.64 secs fish external usr time 51.76 secs 264.00 micros 51.76 secs sys time 30.49 secs 739.00 micros 30.49 secs ``` ``` time git submodule update --init --recursive --jobs 0 # use all online cpus ________________________________________________________ Executed in 129.75 secs fish external usr time 51.64 secs 181.00 micros 51.64 secs sys time 31.49 secs 781.00 micros 31.49 secs ``` Test Plan: Imported from OSS Reviewed By: 1ntEgr8 Differential Revision: D29560875 Pulled By: zhouzhuojie fbshipit-source-id: 556027dffe744c66428075a8a1bf64683930aaaf
97 lines
3.5 KiB
CMake
97 lines
3.5 KiB
CMake
# - Try to find MKLDNN
|
|
#
|
|
# The following variables are optionally searched for defaults
|
|
# MKL_FOUND : set to true if a library implementing the CBLAS interface is found
|
|
#
|
|
# The following are set after configuration is done:
|
|
# MKLDNN_FOUND : set to true if mkl-dnn is found.
|
|
# MKLDNN_INCLUDE_DIR : path to mkl-dnn include dir.
|
|
# MKLDNN_LIBRARIES : list of libraries for mkl-dnn
|
|
#
|
|
# The following variables are used:
|
|
# MKLDNN_USE_NATIVE_ARCH : Whether native CPU instructions should be used in MKLDNN. This should be turned off for
|
|
# general packaging to avoid incompatible CPU instructions. Default: OFF.
|
|
|
|
IF (NOT MKLDNN_FOUND)
|
|
|
|
SET(MKLDNN_LIBRARIES)
|
|
SET(MKLDNN_INCLUDE_DIR)
|
|
|
|
SET(IDEEP_ROOT "${PROJECT_SOURCE_DIR}/third_party/ideep")
|
|
SET(MKLDNN_ROOT "${IDEEP_ROOT}/mkl-dnn")
|
|
|
|
FIND_PACKAGE(BLAS)
|
|
FIND_PATH(IDEEP_INCLUDE_DIR ideep.hpp PATHS ${IDEEP_ROOT} PATH_SUFFIXES include)
|
|
FIND_PATH(MKLDNN_INCLUDE_DIR mkldnn.hpp mkldnn.h PATHS ${MKLDNN_ROOT} PATH_SUFFIXES include)
|
|
IF (NOT MKLDNN_INCLUDE_DIR)
|
|
EXECUTE_PROCESS(COMMAND git${CMAKE_EXECUTABLE_SUFFIX} submodule update --init --jobs 0 mkl-dnn WORKING_DIRECTORY ${IDEEP_ROOT})
|
|
FIND_PATH(MKLDNN_INCLUDE_DIR mkldnn.hpp mkldnn.h PATHS ${MKLDNN_ROOT} PATH_SUFFIXES include)
|
|
ENDIF(NOT MKLDNN_INCLUDE_DIR)
|
|
|
|
IF (NOT IDEEP_INCLUDE_DIR OR NOT MKLDNN_INCLUDE_DIR)
|
|
MESSAGE(STATUS "MKLDNN source files not found!")
|
|
RETURN()
|
|
ENDIF(NOT IDEEP_INCLUDE_DIR OR NOT MKLDNN_INCLUDE_DIR)
|
|
LIST(APPEND MKLDNN_INCLUDE_DIR ${IDEEP_INCLUDE_DIR})
|
|
IF(MKL_FOUND)
|
|
ADD_DEFINITIONS(-DIDEEP_USE_MKL)
|
|
# Append to mkldnn dependencies
|
|
LIST(APPEND MKLDNN_LIBRARIES ${MKL_LIBRARIES})
|
|
LIST(APPEND MKLDNN_INCLUDE_DIR ${MKL_INCLUDE_DIR})
|
|
ELSE(MKL_FOUND)
|
|
SET(MKLDNN_USE_MKL "NONE" CACHE STRING "" FORCE)
|
|
ENDIF(MKL_FOUND)
|
|
|
|
SET(MKL_cmake_included TRUE)
|
|
IF (NOT MKLDNN_CPU_RUNTIME)
|
|
SET(MKLDNN_CPU_RUNTIME "OMP" CACHE STRING "")
|
|
ELSEIF (MKLDNN_CPU_RUNTIME STREQUAL "TBB")
|
|
IF (USE_TBB)
|
|
MESSAGE(STATUS "MKL-DNN is using TBB")
|
|
|
|
SET(TBB_cmake_included TRUE)
|
|
SET(Threading_cmake_included TRUE)
|
|
|
|
SET(DNNL_CPU_THREADING_RUNTIME ${MKLDNN_CPU_RUNTIME})
|
|
SET(TBB_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/tbb/include")
|
|
INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIRS})
|
|
LIST(APPEND EXTRA_SHARED_LIBS tbb)
|
|
ELSE()
|
|
MESSAGE(FATAL_ERROR "MKLDNN_CPU_RUNTIME is set to TBB but TBB is not used")
|
|
ENDIF()
|
|
ENDIF()
|
|
MESSAGE(STATUS "MKLDNN_CPU_RUNTIME = ${MKLDNN_CPU_RUNTIME}")
|
|
|
|
SET(MKLDNN_BUILD_TESTS FALSE CACHE BOOL "" FORCE)
|
|
SET(MKLDNN_BUILD_EXAMPLES FALSE CACHE BOOL "" FORCE)
|
|
SET(MKLDNN_LIBRARY_TYPE STATIC CACHE STRING "" FORCE)
|
|
SET(DNNL_ENABLE_PRIMITIVE_CACHE TRUE CACHE BOOL "" FORCE)
|
|
IF(MKLDNN_USE_NATIVE_ARCH) # Disable HostOpts in MKLDNN unless MKLDNN_USE_NATIVE_ARCH is set.
|
|
SET(MKLDNN_ARCH_OPT_FLAGS "HostOpts" CACHE STRING "" FORCE)
|
|
ELSE()
|
|
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
IF(CPU_INTEL)
|
|
SET(MKLDNN_ARCH_OPT_FLAGS "-msse4" CACHE STRING "" FORCE)
|
|
ENDIF()
|
|
ELSE()
|
|
SET(MKLDNN_ARCH_OPT_FLAGS "" CACHE STRING "" FORCE)
|
|
ENDIF()
|
|
ENDIF()
|
|
|
|
ADD_SUBDIRECTORY(${MKLDNN_ROOT})
|
|
IF(NOT TARGET dnnl)
|
|
MESSAGE("Failed to include MKL-DNN target")
|
|
RETURN()
|
|
ENDIF(NOT TARGET dnnl)
|
|
|
|
IF(NOT APPLE AND CMAKE_COMPILER_IS_GNUCC)
|
|
TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-maybe-uninitialized)
|
|
TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-strict-overflow)
|
|
TARGET_COMPILE_OPTIONS(dnnl PRIVATE -Wno-error=strict-overflow)
|
|
ENDIF(NOT APPLE AND CMAKE_COMPILER_IS_GNUCC)
|
|
LIST(APPEND MKLDNN_LIBRARIES dnnl)
|
|
|
|
SET(MKLDNN_FOUND TRUE)
|
|
MESSAGE(STATUS "Found MKL-DNN: TRUE")
|
|
|
|
ENDIF(NOT MKLDNN_FOUND)
|