我有以下制作文件
g++ -Wall -O3 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 Matrix.cc -L /usr/lib64/libcblas.so.0 util.cc word_io.cc net_lbl_2reps_scalable.cc train_lbl_2r_ptb.cc -o train_lbl_2r_ptb
但是我得到了错误
/tmp/cc9NLGFL.o: 在函数
Matrix::scaleAddAB(Matrix const&, Matrix const&, float, float)': /home/ncelm/Matrix.cc:316: undefined reference to
cblas_sgemm' /tmp/cc9NLGFL.o: 在函数Matrix::scaleAddAtransB(Matrix const&, Matrix const&, float, float)': /home/ncelm/Matrix.cc:330: undefined reference to
cblas_sgemm' /tmp/cc9NLGFL.o: 在函数Matrix::scaleAddABtrans(Matrix const&, Matrix const&, float, float)': /home/ncelm/Matrix.cc:344: undefined reference to
cblas_sgemm'
发生错误的函数:
void Matrix::scaleAddABtrans(const Matrix &A, const Matrix &B, float targetScale, float prodScale)
{
assert(A.rows() == rows() && A.cols() == B.cols() && B.rows() == cols());
::cblas_sgemm(CblasColMajor, CblasNoTrans, CblasTrans,
A.rows(), B.rows(), A.cols(),
prodScale, // Scale the product by 1
A.data(), A.rows(),
B.data(), B.rows(),
targetScale, // Scale the target by this before adding the product matrix
data(), rows());
}
它能够链接文件但找不到sgemm
. 无法理解为什么?