gpt4 book ai didi

c++ - TBB 与 C++ 的链接

转载 作者:行者123 更新时间:2023-11-28 02:27:39 25 4
gpt4 key购买 nike

我正在尝试在 HPCG 基准测试中使用 TBB 进行一些测试。但是到目前为止我还没有成功编译程序。我收到如下错误:

src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x23): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::execute()':
ComputeSPMV_ref.cpp:(.text+0x182): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x1ad): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x26b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x296): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x43b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x470): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x52c): undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
src/ComputeSPMV_ref.o: In function `ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)':
ComputeSPMV_ref.cpp:(.text+0x9d0): undefined reference to `tbb::task_group_context::init()'
ComputeSPMV_ref.cpp:(.text+0x9e9): undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0xa29): undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
ComputeSPMV_ref.cpp:(.text+0xa52): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xad4): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xae0): undefined reference to `vtable for tbb::task'
ComputeSPMV_ref.cpp:(.text+0xaee): undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD2Ev[_ZN3tbb10interface68internal9flag_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD2Ev[_ZN3tbb10interface68internal11signal_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD0Ev[_ZN3tbb10interface68internal9flag_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD0Ev[_ZN3tbb10interface68internal11signal_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o:(.rodata+0x110): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal11signal_taskE[_ZTIN3tbb10interface68internal11signal_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal9flag_taskE[_ZTIN3tbb10interface68internal9flag_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal9flag_taskE[_ZTVN3tbb10interface68internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal11signal_taskE[_ZTVN3tbb10interface68internal11signal_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
collect2: error: ld returned 1 exit status
make: *** [bin/xhpcg] Error 1

Compile instruction look like this:
make
/usr/bin/g++ -DHPCG_NOMPI -DHPCG_NOOPENMP -I./src -I./src/GCC_TBB -O3 -ltbb -std=c++11 -ffast-math -ftree-vectorize -ftree-vectorizer-verbose=0 -fopenmp testing/main.o src/CG.o src/CG_ref.o ....

我从 Intel 下载并安装了最新的源代码。此外,我已经在编译时使用了 -ltbb 和 -std=c++11,并且我在我的代码中包含了 tbb 文件。到目前为止,我无法弄清楚问题所在。有没有人在使用英特尔 TBB 之前遇到过这样的事情?我假设这与图书馆的链接有关,但我无法弄清楚

最佳答案

尝试在 -o 之前插入“-ltbb -std=c++11”,它应该可以工作!

关于c++ - TBB 与 C++ 的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29993795/

25 4 0
文章推荐: javascript - DOM 中的项目未清除,如何清除缓存
文章推荐: javascript - 将表单值发布到 html
文章推荐: c++ - 方法之间的goto语句C++
文章推荐: javascript - 包含每个选项内容的下拉列表(