Skip to content

Commit

Permalink
【第三方库离线编译】add submodule pocketfft and xbyak (#54344)
Browse files Browse the repository at this point in the history
* add submodule pocketfft

* add submodule xbyak

* remove shallow_copy arg
  • Loading branch information
RedContritio authored Jun 7, 2023
1 parent d9aa85d commit f774780
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
path = third_party/protobuf
url = https://github.com/protocolbuffers/protobuf.git
ignore = dirty
[submodule "third_party/pocketfft"]
path = third_party/pocketfft
url = https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git
ignore = dirty
[submodule "third_party/gflags"]
path = third_party/gflags
url = https://github.com/gflags/gflags.git
Expand Down Expand Up @@ -62,6 +66,10 @@
path = third_party/cutlass
url = https://github.com/NVIDIA/cutlass.git
ignore = dirty
[submodule "third_party/xbyak"]
path = third_party/xbyak
url = https://github.com/herumi/xbyak.git
ignore = dirty
[submodule "third_party/mkldnn"]
path = third_party/mkldnn
url = https://github.com/oneapi-src/oneDNN.git
Expand Down
22 changes: 13 additions & 9 deletions cmake/external/pocketfft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,36 @@ set(POCKETFFT_PATH
CACHE STRING "A path setting for external_pocketfft path.")
set(POCKETFFT_PREFIX_DIR ${POCKETFFT_PATH})

set(POCKETFFT_REPOSITORY https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git)
set(POCKETFFT_TAG release_for_eigen)

set(POCKETFFT_INCLUDE_DIR ${POCKETFFT_PREFIX_DIR}/src)
set(POCKETFFT_SOURCE_DIR ${POCKETFFT_PREFIX_DIR}/src/extern_pocketfft)
message("POCKETFFT_INCLUDE_DIR is ${POCKETFFT_INCLUDE_DIR}")
include_directories(${POCKETFFT_INCLUDE_DIR})

set(POCKETFFT_TAG release_for_eigen)
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/pocketfft)

if(APPLE)
file(TO_NATIVE_PATH
${PADDLE_SOURCE_DIR}/patches/pocketfft/pocketfft_hdronly.h.patch
native_dst)
set(POCKETFFT_PATCH_COMMAND
git checkout -- . && git checkout ${GLOO_TAG} && patch -Nd
${POCKETFFT_INCLUDE_DIR}/extern_pocketfft < ${native_dst})
git checkout -- . && git checkout ${POCKETFFT_TAG} && patch -Nd
${SOURCE_DIR} < ${native_dst})
endif()

ExternalProject_Add(
extern_pocketfft
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${POCKETFFT_REPOSITORY}
GIT_TAG ${POCKETFFT_TAG}
${EXTERNAL_PROJECT_LOG_ARGS}
SOURCE_DIR ${SOURCE_DIR}
PREFIX ${POCKETFFT_PREFIX_DIR}
PATCH_COMMAND ${POCKETFFT_PATCH_COMMAND}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_COMMAND
COMMAND ${CMAKE_COMMAND} -E remove_directory ${POCKETFFT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${POCKETFFT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SOURCE_DIR}
${POCKETFFT_SOURCE_DIR}
INSTALL_COMMAND ""
TEST_COMMAND "")

Expand Down
4 changes: 2 additions & 2 deletions cmake/external/xbyak.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(XBYAK_INSTALL_ROOT ${THIRD_PARTY_PATH}/install/xbyak)
set(XBYAK_INC_DIR ${XBYAK_INSTALL_ROOT}/include)
set(XBYAK_REPOSITORY ${GIT_URL}/herumi/xbyak.git)
set(XBYAK_TAG v5.81) # Dec 19, 2019
set(SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/xbyak)

include_directories(${XBYAK_INC_DIR})
include_directories(${XBYAK_INC_DIR}/xbyak)
Expand All @@ -33,8 +34,7 @@ add_definitions(-DXBYAK_NO_OP_NAMES)
ExternalProject_Add(
${XBYAK_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${XBYAK_REPOSITORY}
GIT_TAG ${XBYAK_TAG}
SOURCE_DIR ${SOURCE_DIR}
DEPENDS ""
PREFIX ${XBYAK_PREFIX_DIR}
UPDATE_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion cmake/third_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ if(WITH_DISTRIBUTE
endif()

if(WITH_XBYAK)
include(external/xbyak) # download, build, install xbyak
include(external/xbyak) # prepare submodule xbyak
list(APPEND third_party_deps extern_xbyak)
endif()

Expand Down
1 change: 1 addition & 0 deletions third_party/pocketfft
Submodule pocketfft added at ea778e
1 change: 1 addition & 0 deletions third_party/xbyak
Submodule xbyak added at 4ca043

0 comments on commit f774780

Please sign in to comment.