未验证 提交 e64e1b97 编写于 作者: C cyberslack_lee 提交者: GitHub

[cmake] add libxsmm,lite,openblas third_party cache (#54380)

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* remove rocksdb change

* fix

* fix

* fix

* fix lite

* fix

* Update lite.cmake

---------
Co-authored-by: Nrisemeup1 <62429225+risemeup1@users.noreply.github.com>
上级 38782dc3
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
include(ExternalProject) include(ExternalProject)
set(LIBXSMM_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/libxsmm)
set(LIBXSMM_TAG 7cc03b5b342fdbc6b6d990b190671c5dbb8489a2)
set(LIBXSMM_PREFIX_DIR ${THIRD_PARTY_PATH}/libxsmm) set(LIBXSMM_PREFIX_DIR ${THIRD_PARTY_PATH}/libxsmm)
set(LIBXSMM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/libxsmm) set(LIBXSMM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/libxsmm)
set(LIBXSMM_INCLUDE_DIR set(LIBXSMM_INCLUDE_DIR
...@@ -25,11 +28,31 @@ set(LIBXSMM_LIBRARY_DIR ...@@ -25,11 +28,31 @@ set(LIBXSMM_LIBRARY_DIR
set(LIBXSMM_LIB "${LIBXSMM_LIBRARY_DIR}/libxsmm.a") set(LIBXSMM_LIB "${LIBXSMM_LIBRARY_DIR}/libxsmm.a")
set(LIBXSMMNOBLAS_LIB "${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a") set(LIBXSMMNOBLAS_LIB "${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
file(GLOB LIBXSMM_SOURCE_FILE_LIST ${LIBXSMM_SOURCE_DIR})
list(LENGTH LIBXSMM_SOURCE_FILE_LIST RES_LEN)
if(RES_LEN EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} clone -b ${LIBXSMM_TAG}
"https://github.com/hfp/libxsmm.git" ${LIBXSMM_SOURCE_DIR})
else()
# check git tag
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --abbrev=6 --always --tags
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
WORKING_DIRECTORY ${LIBXSMM_SOURCE_DIR})
if(NOT ${VERSION} STREQUAL ${LIBXSMM_TAG})
message(
WARNING "libxsmm version is not ${VERSION}, checkout to ${LIBXSMM_TAG}")
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${LIBXSMM_TAG}
WORKING_DIRECTORY ${LIBXSMM_SOURCE_DIR})
endif()
endif()
ExternalProject_Add( ExternalProject_Add(
extern_libxsmm extern_libxsmm
${SHALLOW_CLONE} ${EXTERNAL_PROJECT_LOG_ARGS}
GIT_REPOSITORY "${GIT_URL}/hfp/libxsmm.git" SOURCE_DIR ${LIBXSMM_SOURCE_DIR}
GIT_TAG "7cc03b5b342fdbc6b6d990b190671c5dbb8489a2"
PREFIX ${LIBXSMM_PREFIX_DIR} PREFIX ${LIBXSMM_PREFIX_DIR}
UPDATE_COMMAND "" UPDATE_COMMAND ""
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
......
...@@ -16,7 +16,7 @@ include(ExternalProject) ...@@ -16,7 +16,7 @@ include(ExternalProject)
set(CBLAS_PREFIX_DIR ${THIRD_PARTY_PATH}/openblas) set(CBLAS_PREFIX_DIR ${THIRD_PARTY_PATH}/openblas)
set(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas) set(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas)
set(CBLAS_REPOSITORY ${GIT_URL}/xianyi/OpenBLAS.git) set(CBLAS_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/openblas)
set(CBLAS_TAG v0.3.7) set(CBLAS_TAG v0.3.7)
# Why use v0.3.18? The IDG business line encountered a random openblas error, # Why use v0.3.18? The IDG business line encountered a random openblas error,
...@@ -43,6 +43,27 @@ if(WITH_LOONGARCH) ...@@ -43,6 +43,27 @@ if(WITH_LOONGARCH)
set(CBLAS_TAG v0.3.18) set(CBLAS_TAG v0.3.18)
endif() endif()
file(GLOB CBLAS_SOURCE_FILE_LIST ${CBLAS_SOURCE_DIR})
list(LENGTH CBLAS_SOURCE_FILE_LIST RES_LEN)
if(RES_LEN EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} clone -b ${CBLAS_TAG}
"https://github.com/xianyi/OpenBLAS.git" ${CBLAS_SOURCE_DIR})
else()
# check git tag
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --abbrev=6 --always --tags
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
WORKING_DIRECTORY ${CBLAS_SOURCE_DIR})
if(NOT ${VERSION} STREQUAL ${CBLAS_TAG})
message(
WARNING "openblas version is not ${VERSION}, checkout to ${CBLAS_TAG}")
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${CBLAS_TAG}
WORKING_DIRECTORY ${CBLAS_SOURCE_DIR})
endif()
endif()
if(NOT WIN32) if(NOT WIN32)
set(CBLAS_LIBRARIES set(CBLAS_LIBRARIES
"${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}"
...@@ -64,9 +85,8 @@ if(NOT WIN32) ...@@ -64,9 +85,8 @@ if(NOT WIN32)
set(COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs) set(COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs)
ExternalProject_Add( ExternalProject_Add(
extern_openblas extern_openblas
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE} ${EXTERNAL_PROJECT_LOG_ARGS}
GIT_REPOSITORY ${CBLAS_REPOSITORY} SOURCE_DIR ${CBLAS_SOURCE_DIR}
GIT_TAG ${CBLAS_TAG}
PREFIX ${CBLAS_PREFIX_DIR} PREFIX ${CBLAS_PREFIX_DIR}
INSTALL_DIR ${CBLAS_INSTALL_DIR} INSTALL_DIR ${CBLAS_INSTALL_DIR}
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
...@@ -85,8 +105,7 @@ else() ...@@ -85,8 +105,7 @@ else()
ExternalProject_Add( ExternalProject_Add(
extern_openblas extern_openblas
${EXTERNAL_PROJECT_LOG_ARGS} ${EXTERNAL_PROJECT_LOG_ARGS}
GIT_REPOSITORY ${CBLAS_REPOSITORY} SOURCE_DIR ${CBLAS_SOURCE_DIR}
GIT_TAG ${CBLAS_TAG}
PREFIX ${CBLAS_PREFIX_DIR} PREFIX ${CBLAS_PREFIX_DIR}
INSTALL_DIR ${CBLAS_INSTALL_DIR} INSTALL_DIR ${CBLAS_INSTALL_DIR}
BUILD_IN_SOURCE 0 BUILD_IN_SOURCE 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册