Skip to content
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

在first branch增加代码,编译链接出错 #11

Open
lambda7xx opened this issue Jun 24, 2023 · 3 comments
Open

在first branch增加代码,编译链接出错 #11

lambda7xx opened this issue Jun 24, 2023 · 3 comments

Comments

@lambda7xx
Copy link

lambda7xx commented Jun 24, 2023

我的系统是ubuntu22, 安装了armadillo-12.4.1, 我在test_first增加的代码如下,

//
// Created by fss on 22-12-13.
//

#include <gtest/gtest.h>
#include <armadillo>
#include <glog/logging.h>

TEST(test_first, demo1) {
  LOG(INFO) << "My first test!";
  arma::fmat in_1(32, 32, arma::fill::ones);
  ASSERT_EQ(in_1.n_cols, 32);
  ASSERT_EQ(in_1.n_rows, 32);
  ASSERT_EQ(in_1.size(), 32 * 32);
}

TEST(test_first, linear) {
  arma::fmat A = "1,2,3;"
                 "4,5,6;"
                 "7,8,9;";

  arma::fmat X = "1,1,1;"
                 "1,1,1;"
                 "1,1,1;";

  arma::fmat bias = "1,1,1;"
                    "1,1,1;"
                    "1,1,1;";

  arma::fmat output = A * X + bias;
  //todo 在此处插入代码,完成output = AxX + bias的运算
  // output = ?

  const uint32_t cols = 3;
  for (uint32_t c = 0; c < cols; ++c) {
    float *col_ptr = output.colptr(c);
    ASSERT_EQ(*(col_ptr + 0), 7);
    ASSERT_EQ(*(col_ptr + 1), 16);
    ASSERT_EQ(*(col_ptr + 2), 25);
  }
  LOG(INFO) << "\n" <<"Result Passed!";
}

报错是

/usr/bin/ld: CMakeFiles/test_kuiper_course.dir/test_first.cpp.o: in function `void arma::blas::gemv<float>(char const*, int const*, int const*, float const*, float const*, int const*, float const*, int const*, float const*, float*, int const*)':
test_first.cpp:(.text._ZN4arma4blas4gemvIfEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemvIfEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x57): undefined reference to `wrapper2_sgemv_'
/usr/bin/ld: CMakeFiles/test_kuiper_course.dir/test_first.cpp.o: in function `void arma::blas::gemm<float>(char const*, char const*, int const*, int const*, int const*, float const*, float const*, int const*, float const*, int const*, float const*, float*, int const*)':
test_first.cpp:(.text._ZN4arma4blas4gemmIfEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemmIfEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x63): undefined reference to `wrapper2_sgemm_'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/test_kuiper_course.dir/build.make:113: test/test_kuiper_course] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: test/CMakeFiles/test_kuiper_course.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
@lambda7xx
Copy link
Author

@zjhellofss 希望能帮忙解决下,google了不少没找到解决方法,谢谢

@jzymessi
Copy link

@lambda7xx 试试这个:
image

@lambda7xx
Copy link
Author

@lambda7xx 试试这个: image
好的,thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants