-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add external openblas #1150
Add external openblas #1150
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
INCLUDE(cblas) | ||
|
||
IF(NOT ${CBLAS_FOUND}) | ||
MESSAGE(FATAL_ERROR "Please install OpenBlas, MKL or ATLAS.") | ||
INCLUDE(ExternalProject) | ||
|
||
SET(CBLAS_SOURCES_DIR ${THIRD_PARTY_PATH}/openblas) | ||
|
@@ -28,20 +27,40 @@ IF(NOT ${CBLAS_FOUND}) | |
SET(CBLAS_LIBRARIES "${CBLAS_INSTALL_DIR}/lib/libopenblas.a" CACHE FILEPATH "openblas library" FORCE) | ||
ENDIF(WIN32) | ||
|
||
IF(CMAKE_COMPILER_IS_GNUCC) | ||
ENABLE_LANGUAGE(Fortran) | ||
LIST(APPEND CBLAS_LIBRARIES gfortran pthread) | ||
ENDIF(CMAKE_COMPILER_IS_GNUCC) | ||
|
||
IF(NOT CMAKE_Fortran_COMPILER) | ||
MESSAGE(FATAL_ERROR "To build lapack in libopenblas, " | ||
"you need to set gfortran compiler: cmake .. -DCMAKE_Fortran_COMPILER=...") | ||
ENDIF(NOT CMAKE_Fortran_COMPILER) | ||
|
||
ExternalProject_Add( | ||
openblas | ||
${EXTERNAL_PROJECT_LOG_ARGS} | ||
URL "https://github.com/xianyi/OpenBLAS/archive/v0.2.19.tar.gz" | ||
GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git | ||
GIT_TAG v0.2.19 | ||
PREFIX ${CBLAS_SOURCES_DIR} | ||
INSTALL_DIR ${CBLAS_INSTALL_DIR} | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND make CC=${CMAKE_C_COMPILER} FC=${CMAKE_Fortran_COMPILER} | ||
INSTALL_COMMAND make install PREFIX=<INSTALL_DIR> | ||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} FC=${CMAKE_Fortran_COMPILER} CC=${CMAKE_C_COMPILER} HOSTCC=${CMAKE_C_COMPILER} NO_SHARED=1 libs netlib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 编译时间太长,有make libs netlib就行了,去掉test部分 |
||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install NO_SHARED=1 PREFIX=<INSTALL_DIR> | ||
UPDATE_COMMAND "" | ||
CONFIGURE_COMMAND "" | ||
) | ||
|
||
ExternalProject_Add_Step( | ||
openblas lapacke_install | ||
COMMAND ${CMAKE_COMMAND} -E copy "${CBLAS_SOURCES_DIR}/src/openblas/lapack-netlib/LAPACKE/include/lapacke_mangling_with_flags.h" "${CBLAS_INSTALL_DIR}/include/lapacke_mangling.h" | ||
COMMAND ${CMAKE_COMMAND} -E copy "${CBLAS_SOURCES_DIR}/src/openblas/lapack-netlib/LAPACKE/include/lapacke.h" "${CBLAS_INSTALL_DIR}/include/lapacke.h" | ||
COMMAND ${CMAKE_COMMAND} -E copy "${CBLAS_SOURCES_DIR}/src/openblas/lapack-netlib/LAPACKE/include/lapacke_config.h" "${CBLAS_INSTALL_DIR}/include/lapacke_config.h" | ||
COMMAND ${CMAKE_COMMAND} -E copy "${CBLAS_SOURCES_DIR}/src/openblas/lapack-netlib/LAPACKE/include/lapacke_utils.h" "${CBLAS_INSTALL_DIR}/include/lapacke_utils.h" | ||
DEPENDEES install | ||
) | ||
|
||
LIST(APPEND external_project_dependencies openblas) | ||
ENDIF() | ||
ENDIF(NOT ${CBLAS_FOUND}) | ||
|
||
INCLUDE_DIRECTORIES(${CBLAS_INC_DIR}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ IF(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) | |
"please use pip to upgrade protobuf.") | ||
ENDIF(${PY_GOOGLE.PROTOBUF_VERSION} VERSION_LESS "3.0.0") | ||
ELSE(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) | ||
MESSAGE(FATAL_ERROR "Please install python 2.7 before building PaddlePaddle.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 先就用系统python吧, python这块还不太稳定,并没有进行过详细测试。 |
||
##################################### PYTHON ######################################## | ||
SET(PYTHON_SOURCES_DIR ${THIRD_PARTY_PATH}/python) | ||
SET(PYTHON_INSTALL_DIR ${THIRD_PARTY_PATH}/install/python) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ SET(EXTERNAL_PROJECT_LOG_ARGS | |
LOG_DOWNLOAD 0 # Wrap download in script to log output | ||
LOG_UPDATE 1 # Wrap update in script to log output | ||
LOG_CONFIGURE 1 # Wrap configure in script to log output | ||
LOG_BUILD 1 # Wrap build in script to log output | ||
LOG_BUILD 0 # Wrap build in script to log output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 开启external project 编译和安装信息输出到屏幕,有些依赖编译时间长,没有输出,会让人感觉卡住了。 |
||
LOG_TEST 1 # Wrap test in script to log output | ||
LOG_INSTALL 1 # Wrap install in script to log output | ||
LOG_INSTALL 0 # Wrap install in script to log output | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
#!/bin/bash | ||
brew update | ||
brew tap homebrew/science | ||
brew install python | ||
sudo pip install --upgrade protobuf | ||
brew install swig openblas md5sha1sum protobuf | ||
brew install openblas swig md5sha1sum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
保留手动配置不同的CBLAS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@backyes 内部有需求