add build.sh & openblas

pull/1531/head
SmileGoat 3 years ago
parent ca5ed023db
commit cd3c57d563

@ -49,24 +49,7 @@ include_directories(${absl_SOURCE_DIR})
#) #)
#FetchContent_MakeAvailable(libsndfile) #FetchContent_MakeAvailable(libsndfile)
#boost
set(boost_SOURCE_DIR ${fc_patch}/boost-src) set(boost_SOURCE_DIR ${fc_patch}/boost-src)
set(boost_PREFIX_DIR ${fc_patch}/boost-subbuild/boost-prefix)
include(ExternalProject)
ExternalProject_Add(
boost
URL https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
SOURCE_DIR ${boost_SOURCE_DIR}
PREFIX ${boost_PREFIX_DIR}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./bootstrap.sh
BUILD_COMMAND ./b2
INSTALL_COMMAND ""
)
link_directories(${boost_SOURCE_DIR}/stage/lib)
include_directories(${boost_SOURCE_DIR})
set(BOOST_ROOT ${boost_SOURCE_DIR}) set(BOOST_ROOT ${boost_SOURCE_DIR})
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
@ -75,10 +58,9 @@ FetchContent_Declare(
GIT_TAG "df2d717e95183f79a90b2fa6e4307083a351ca6a" GIT_TAG "df2d717e95183f79a90b2fa6e4307083a351ca6a"
) )
FetchContent_MakeAvailable(kenlm) FetchContent_MakeAvailable(kenlm)
add_dependencies(kenlm boost)
include_directories(${kenlm_SOURCE_DIR}) include_directories(${kenlm_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fPIC -O0 -Wall -g -ggdb") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pthread -fPIC -O0 -Wall -g")
# gflags # gflags
FetchContent_Declare( FetchContent_Declare(
gflags gflags
@ -98,11 +80,11 @@ FetchContent_MakeAvailable(glog)
include_directories(${glog_BINARY_DIR} ${glog_SOURCE_DIR}/src) include_directories(${glog_BINARY_DIR} ${glog_SOURCE_DIR}/src)
# gtest # gtest
FetchContent_Declare(googletest #FetchContent_Declare(googletest
URL https://github.com/google/googletest/archive/release-1.10.0.zip #URL https://github.com/google/googletest/archive/release-1.10.0.zip
URL_HASH SHA256=94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91 #URL_HASH SHA256=94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91
) #)
FetchContent_MakeAvailable(googletest) #FetchContent_MakeAvailable(googletest)
# openfst # openfst
set(openfst_SOURCE_DIR ${fc_patch}/openfst-src) set(openfst_SOURCE_DIR ${fc_patch}/openfst-src)
@ -142,14 +124,10 @@ set(PADDLE_LIB ${fc_patch}/paddle-lib)
include_directories("${PADDLE_LIB}/paddle/include") include_directories("${PADDLE_LIB}/paddle/include")
set(PADDLE_LIB_THIRD_PARTY_PATH "${PADDLE_LIB}/third_party/install/") set(PADDLE_LIB_THIRD_PARTY_PATH "${PADDLE_LIB}/third_party/install/")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/include")
#include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/include")
#include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/include")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/lib")
#link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/lib")
#link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/lib")
link_directories("${PADDLE_LIB}/paddle/lib") link_directories("${PADDLE_LIB}/paddle/lib")
@ -171,23 +149,30 @@ set(DEPS ${DEPS}
glog gflags protobuf xxhash cryptopp glog gflags protobuf xxhash cryptopp
${EXTERNAL_LIB}) ${EXTERNAL_LIB})
add_subdirectory(speechx)
#openblas #openblas
#set(OpenBLAS_INSTALL_PREFIX ${fc_patch}/OpenBLAS) set(OpenBLAS_INSTALL_PREFIX ${fc_patch}/OpenBLAS)
#set(OpenBLAS_SOURCE_DIR ${fc_patch}/OpenBLAS-src) set(OpenBLAS_SOURCE_DIR ${fc_patch}/OpenBLAS-src)
#ExternalProject_Add( set(OpenBLAS_PREFIX ${fc_patch}/OpenBLAS-prefix)
# OpenBLAS ExternalProject_Add(
# GIT_REPOSITORY https://github.com/xianyi/OpenBLAS OpenBLAS
# GIT_TAG v0.3.13 GIT_REPOSITORY https://github.com/xianyi/OpenBLAS
# GIT_SHALLOW TRUE GIT_TAG 1ef97c470ccf23d06d3bb0597c52df4a2e9093b9
# GIT_PROGRESS TRUE GIT_SHALLOW TRUE
# CONFIGURE_COMMAND "" GIT_PROGRESS TRUE
# BUILD_IN_SOURCE TRUE PREFIX ${OpenBLAS_PREFIX}
# BUILD_COMMAND make USE_LOCKING=1 USE_THREAD=0 SOURCE_DIR ${OpenBLAS_SOURCE_DIR}
# INSTALL_COMMAND make PREFIX=${OpenBLAS_INSTALL_PREFIX} install BUILD_IN_SOURCE TRUE
# UPDATE_DISCONNECTED TRUE CONFIGURE_COMMAND ""
#) BUILD_COMMAND make
INSTALL_COMMAND make PREFIX=${OpenBLAS_INSTALL_PREFIX} install
UPDATE_DISCONNECTED TRUE
)
link_directories(${OpenBLAS_INSTALL_PREFIX}/lib)
include_directories(${OpenBLAS_INSTALL_PREFIX}/include)
link_directories(/usr/local/gcc-8.2/lib64)
add_subdirectory(speechx)
############################################################################### ###############################################################################
# Add local library # Add local library

@ -0,0 +1,23 @@
#!/usr/bin/env bash
boost_SOURCE_DIR=$PWD/fc_patch/boost-src
if [ ! -d ${boost_SOURCE_DIR} ]; then
wget https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz
tar xzfv boost_1_75_0.tar.gz
mkdir -p $PWD/fc_patch
mv boost_1_75_0 ${boost_SOURCE_DIR}
cd ${boost_SOURCE_DIR}
bash ./bootstrap.sh
./b2
cd -
echo -e "\n"
fi
mkdir build
cd build
cmake .. -DBOOST_ROOT:STRING=${boost_SOURCE_DIR}
make
cd -

@ -33,7 +33,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/decoder
add_subdirectory(decoder) add_subdirectory(decoder)
add_executable(mfcc-test codelab/feat_test/feature-mfcc-test.cc) add_executable(mfcc-test codelab/feat_test/feature-mfcc-test.cc)
target_link_libraries(mfcc-test kaldi-mfcc ${MATH_LIB}) target_link_libraries(mfcc-test kaldi-mfcc)
add_executable(linear_spectrogram_main codelab/feat_test/linear_spectrogram_main.cc) add_executable(linear_spectrogram_main codelab/feat_test/linear_spectrogram_main.cc)
target_link_libraries(linear_spectrogram_main frontend kaldi-util kaldi-feat-common gflags glog) target_link_libraries(linear_spectrogram_main frontend kaldi-util kaldi-feat-common gflags glog)

@ -13,4 +13,4 @@ srfft.cc
tp-matrix.cc tp-matrix.cc
) )
target_link_libraries(kaldi-matrix gfortran kaldi-base ${MATH_LIB}) target_link_libraries(kaldi-matrix gfortran kaldi-base libopenblas.a)

@ -42,7 +42,7 @@
#define HAVE_MKL #define HAVE_OPENBLAS
#if (defined(HAVE_CLAPACK) && (defined(HAVE_ATLAS) || defined(HAVE_MKL))) \ #if (defined(HAVE_CLAPACK) && (defined(HAVE_ATLAS) || defined(HAVE_MKL))) \
|| (defined(HAVE_ATLAS) && defined(HAVE_MKL)) || (defined(HAVE_ATLAS) && defined(HAVE_MKL))
@ -96,8 +96,8 @@
#elif defined(HAVE_OPENBLAS) #elif defined(HAVE_OPENBLAS)
// getting cblas.h and lapacke.h from <openblas-install-dir>/. // getting cblas.h and lapacke.h from <openblas-install-dir>/.
// putting in "" not <> to search -I before system libraries. // putting in "" not <> to search -I before system libraries.
#include "third_party/openblas/cblas.h" #include "cblas.h"
#include "third_party/openblas/lapacke.h" #include "lapacke.h"
#undef I #undef I
#undef complex #undef complex
// get rid of macros from f2c.h -- these are dangerous. // get rid of macros from f2c.h -- these are dangerous.

Loading…
Cancel
Save