Skip to content

Commit

Permalink
Back out "[FBGEMM][PR] switch from cmake downloads to git submodules"
Browse files Browse the repository at this point in the history
Summary: Original commit changeset: 9a33573ba34b

Reviewed By: jianyuh

Differential Revision: D15320950

fbshipit-source-id: f6501b57346cc5e82fa2198dcf6b60b26cd4f7c6
  • Loading branch information
dskhudia authored and facebook-github-bot committed May 13, 2019
1 parent c21a93d commit b14f582
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 21 deletions.
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,16 @@ target_compile_options(fbgemm_avx512 PRIVATE
if(NOT TARGET asmjit)
#Download asmjit from github if ASMJIT_SRC_DIR is not specified.
if(NOT DEFINED ASMJIT_SRC_DIR)
set(ASMJIT_SRC_DIR "${CMAKE_SOURCE_DIR}/third_party/asmjit" CACHE STRING
"asmjit source directory from submodules")
message(STATUS "Downloading asmjit to ${FBGEMM_THIRDPARTY_DIR}/asmjit
(define ASMJIT_SRC_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadASMJIT.cmake"
"${FBGEMM_BINARY_DIR}/asmjit-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/asmjit-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/asmjit-download")
set(ASMJIT_SRC_DIR "${FBGEMM_THIRDPARTY_DIR}/asmjit" CACHE STRING
"asmjit source directory")
endif()

#build asmjit
Expand All @@ -119,8 +127,16 @@ endif()
if(NOT TARGET cpuinfo)
#Download cpuinfo from github if CPUINFO_SOURCE_DIR is not specified.
if(NOT DEFINED CPUINFO_SOURCE_DIR)
set(CPUINFO_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/cpuinfo" CACHE STRING
"cpuinfo source directory from submodules")
message(STATUS "Downloading cpuinfo to ${FBGEMM_THIRDPARTY_DIR}/cpuinfo
(define CPUINFO_SOURCE_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadCPUINFO.cmake"
"${FBGEMM_BINARY_DIR}/cpuinfo-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/cpuinfo-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/cpuinfo-download")
set(CPUINFO_SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/cpuinfo" CACHE STRING
"cpuinfo source directory")
endif()

#build cpuinfo
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ is **on**. Turn it off by setting FBGEMM\_BUILD\_TESTS to off.
You can download [asmjit][1], [cpuinfo][2], [googletest][3] and set
ASMJIT\_SRC\_DIR, CPUINFO\_SRC\_DIR, GOOGLETEST\_SOURCE\_DIR respectively for
cmake to find these libraries. If any of these variables is not set, cmake will
build the git submodules found in the third\_party directory.
try to download that missing library in a folder called third\_party in the
build directory and build it using the downloaded source code.

FBGEMM, in general, does not have any dependency on Intel MKL. However, for
performance comparison, some benchmarks use MKL functions. If MKL is found or
Expand All @@ -62,8 +63,6 @@ not found, the benchmarks are not built.
General build instructions are as follows:

```
git clone --recursive https://github.com/pytorch/FBGEMM.git
cd FBGEMM
mkdir build && cd build
cmake ..
make
Expand Down
16 changes: 16 additions & 0 deletions cmake/modules/DownloadASMJIT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(asmjit-download NONE)

include(ExternalProject)

ExternalProject_Add(asmjit
GIT_REPOSITORY https://github.com/asmjit/asmjit
GIT_TAG 673dcefaa048c5f5a2bf8b85daf8f7b9978d018a
SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/asmjit"
BINARY_DIR "${FBGEMM_BINARY_DIR}/asmjit"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
16 changes: 16 additions & 0 deletions cmake/modules/DownloadCPUINFO.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(cpuinfo-download NONE)

include(ExternalProject)

ExternalProject_Add(cpuinfo
GIT_REPOSITORY https://github.com/pytorch/cpuinfo
GIT_TAG master
SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/cpuinfo"
BINARY_DIR "${FBGEMM_BINARY_DIR}/cpuinfo"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
16 changes: 16 additions & 0 deletions cmake/modules/DownloadGTEST.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(googletest-download NONE)

include(ExternalProject)

ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG 0fc5466dbb9e623029b1ada539717d10bd45e99e
SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/googletest"
BINARY_DIR "${FBGEMM_BINARY_DIR}/googletest"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
13 changes: 11 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ if(FBGEMM_BUILD_TESTS AND NOT TARGET gtest)
#Download Googletest framework from github if
#GOOGLETEST_SOURCE_DIR is not specified.
if(NOT DEFINED GOOGLETEST_SOURCE_DIR)
set(GOOGLETEST_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/googletest"
CACHE STRING "googletest source directory from submodules")
message(STATUS "Downloading googletest to
${FBGEMM_THIRDPARTY_DIR}/googletest
(define GOOGLETEST_SOURCE_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadGTEST.cmake"
"${FBGEMM_BINARY_DIR}/googletest-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/googletest-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/googletest-download")
set(GOOGLETEST_SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/googletest" CACHE STRING
"googletest source directory")
endif()

#build Googletest framework
Expand Down
1 change: 0 additions & 1 deletion third_party/asmjit

This file was deleted.

1 change: 0 additions & 1 deletion third_party/cpuinfo

This file was deleted.

1 change: 0 additions & 1 deletion third_party/googletest

This file was deleted.

0 comments on commit b14f582

Please sign in to comment.