<TiXmlDocument>在此卸载区域中使用的 map<shared_ptr、double> 不可按位复制
map<shared_ptr<TiXmlDocument>, double> used in this offload region is not bitwise copyable
我正在使用英特尔C++编译器 v14.0.3。下面的代码困扰着我:
#include <tinyxml/tinyxml.h>
#include <memory>
#include <map>
#include "offload.h"
using namespace std;
typedef map<shared_ptr<TiXmlDocument>, double,
less<shared_ptr<TiXmlDocument> >,
__offload::shared_allocator<pair<shared_ptr<TiXmlDocument>, double> > > xmlanddbl;
__declspec(target(mic)) _Cilk_shared xmlanddbl m;
int main(void)
{
const int maxct = 10;
for(int i = 0; i < 10; i++){
shared_ptr<TiXmlDocument> doc(new TiXmlDocument);
if(doc && doc->LoadFile("something.xml")){
m.insert(make_pair(doc, 0.0));
}
}
for(int ct = 0; ct < maxct; ct++){
#pragma offload target(mic) mandatory
#pragma omp parallel
#pragma omp single
{
for(auto it = m.begin(); it != m.end(); it++){
#pragma omp task firstprivate(it)
{
someclass obj(it->first);
it->second = obj.eval();
}
}
#pragma omp taskwait
}
somefunction(m);
}
return 0;
}
编译器给出以下消息:
$ icpc -c thiscode.cpp -O2 -openmp -parallel -std=c++11 -I./include
thiscode.cpp(24): error: variable "m" used in this offload region is not bitwise copyable
#pragma offload target(mic) mandatory
^
compilation aborted for thiscode.cpp (code 2)
我已经阅读了此页面。但是我想不出如何传输这些数据。我能做什么?
对不起,我的英语不好。谢谢。
我想不出如何传输这些数据。我能做什么?
从您链接的文档中:
"如果CPU和协处理器之间交换的数据比简单的标量和按位可复制数组更复杂,则可以考虑使用_Cilk_shared/_Cilk_offload结构。
#pragma offload
将不起作用,因为 std::map 太复杂而无法按位复制。
相关文章:
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 呼叫运营商<<临时
- 如何防止clang格式在流运算符调用之间添加换行符<<
- <<操作员在下面的行中工作
- EASTL矢量<向量<int>>连续的
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是std :: set&lt; std :: future&gt;不可能存在
- 是numeric_limits&lt; int&gt; :: is_modulo从逻辑上矛盾
- opencv 2.4.7在iOS错误背景_segm.hpp #include&lt; list&gt;未找到
- 在修改列表后,std :: list&lt; t&gt; :: end()的值是否会更改
- ///<评论></评论>在Visual Studio中