我正在尝试在一段至强融核卸载代码中使用英特尔 TBB。代码无法编译并出现错误error : *MIC* cannot open source file "tbb\parallel_for.h"
我安装了 MPSS 堆栈,运行了该binutils.msi
实用程序,我在卸载的代码文件顶部的包含如下:
#include <offload.h>
#pragma offload_attribute(push, target(mic))
#include <tbb\parallel_for.h>
#pragma offload_attribute(pop)
//other includes and code follows
为什么会失败?
我需要更改什么才能成功卸载和运行我的代码?
编辑 :
将-tbb
选项添加到“MIC 卸载编译器的附加选项”后,编译器找到了该<tbb\parallel_for.h>
文件,但是它给出了几个关于 tbb 库代码未标记为共享的警告和错误。以下是我卸载的代码段。
#pragma offload target(mic:0) in(nums) out(results)
tbb::parallel_for<int>(0,ARRAY_SIZE,1,[&](int i)
{
results[i] = findZero(nums[i]);
});