diff options
author | David Pollack <david@da3.net> | 2019-05-13 20:46:36 +0300 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-05-13 20:49:40 +0300 |
commit | c21a93d62898df77c4cebbbfa0f885f03c08483c (patch) | |
tree | 7eb67fc339785ac275537c6626c7744a3d404ff2 | |
parent | 6ec218e6ed5dcb9b5397a608a3b5b8027b236819 (diff) |
switch from cmake downloads to git submodules (#95)
Summary:
I created a pull request for #87. I also tend to do a lot of hacking without an internet connection and it is nice to have the required library offline. I also get a cryptic error message when I build pytorch without an internet connection because these modules aren't available.
Pull Request resolved: https://github.com/pytorch/FBGEMM/pull/95
Reviewed By: jianyuh
Differential Revision: D15299133
Pulled By: dskhudia
fbshipit-source-id: 6cf9ed47482eceee5f0444a8361720e0cfe25a13
-rw-r--r-- | .gitmodules | 9 | ||||
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | cmake/modules/DownloadASMJIT.cmake | 16 | ||||
-rw-r--r-- | cmake/modules/DownloadCPUINFO.cmake | 16 | ||||
-rw-r--r-- | cmake/modules/DownloadGTEST.cmake | 16 | ||||
-rw-r--r-- | test/CMakeLists.txt | 13 | ||||
l--------- | third_party/asmjit | 1 | ||||
l--------- | third_party/cpuinfo | 1 | ||||
l--------- | third_party/googletest | 1 |
10 files changed, 21 insertions, 81 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f77694d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "third_party/asmjit"] + path = third_party/asmjit + url = https://github.com/asmjit/asmjit.git +[submodule "third_party/cpuinfo"] + path = third_party/cpuinfo + url = https://github.com/pytorch/cpuinfo.git +[submodule "third_party/googletest"] + path = third_party/googletest + url = https://github.com/google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 494e261..036b824 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,16 +106,8 @@ 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) - 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") + set(ASMJIT_SRC_DIR "${CMAKE_SOURCE_DIR}/third_party/asmjit" CACHE STRING + "asmjit source directory from submodules") endif() #build asmjit @@ -127,16 +119,8 @@ endif() if(NOT TARGET cpuinfo) #Download cpuinfo from github if CPUINFO_SOURCE_DIR is not specified. if(NOT DEFINED CPUINFO_SOURCE_DIR) - 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") + set(CPUINFO_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/cpuinfo" CACHE STRING + "cpuinfo source directory from submodules") endif() #build cpuinfo @@ -51,8 +51,7 @@ 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 -try to download that missing library in a folder called third\_party in the -build directory and build it using the downloaded source code. +build the git submodules found in the third\_party directory. 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 @@ -63,6 +62,8 @@ 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 diff --git a/cmake/modules/DownloadASMJIT.cmake b/cmake/modules/DownloadASMJIT.cmake deleted file mode 100644 index ca39600..0000000 --- a/cmake/modules/DownloadASMJIT.cmake +++ /dev/null @@ -1,16 +0,0 @@ -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 "" -) diff --git a/cmake/modules/DownloadCPUINFO.cmake b/cmake/modules/DownloadCPUINFO.cmake deleted file mode 100644 index 529dcc2..0000000 --- a/cmake/modules/DownloadCPUINFO.cmake +++ /dev/null @@ -1,16 +0,0 @@ -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 "" -) diff --git a/cmake/modules/DownloadGTEST.cmake b/cmake/modules/DownloadGTEST.cmake deleted file mode 100644 index 2d1286b..0000000 --- a/cmake/modules/DownloadGTEST.cmake +++ /dev/null @@ -1,16 +0,0 @@ -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 "" -) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f68da73..dfd1f24 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,17 +4,8 @@ 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) - 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") + set(GOOGLETEST_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third_party/googletest" + CACHE STRING "googletest source directory from submodules") endif() #build Googletest framework diff --git a/third_party/asmjit b/third_party/asmjit new file mode 120000 index 0000000..c03bbae --- /dev/null +++ b/third_party/asmjit @@ -0,0 +1 @@ +Subproject commit fc251c914e77cd079e58982cdab00a47539d7fc5 diff --git a/third_party/cpuinfo b/third_party/cpuinfo new file mode 120000 index 0000000..093645e --- /dev/null +++ b/third_party/cpuinfo @@ -0,0 +1 @@ +Subproject commit d5e37adf1406cf899d7d9ec1d317c47506ccb970 diff --git a/third_party/googletest b/third_party/googletest new file mode 120000 index 0000000..88ae7c6 --- /dev/null +++ b/third_party/googletest @@ -0,0 +1 @@ +Subproject commit 3f5b5b8f8493a03fa25f1e4a7eae7678514a431d |