0

我的问题是卸载区域的代码是否包含 c++ 对象?还是只是 STL?

4

1 回答 1

1

Documentation of #pragma offload from intel C++ Compiler XE 13.1 list no limits for the offloaded statement.

Addition of #pragma offload_attribute (push, target (mic)) may be needed for classes, like in examples from offload_attribute reference:

Specifies that all functions and variables declared subsequent to the pragma are available on the coprocessor. This pragma only applies to Intel® MIC Architecture.

fileB.cpp

#pragma offload_attribute (push,target(mic)) #include "fileA.h"
class B : public A {
...
};
#pragma offload_attribute (pop)

But at the same time book Intel Xeon Phi Coprocessor High Performance Programming (by Jim Jeffers and James Reinders, Morgan Kaufmann, ISBN 9780124104143) says that in "Pragma Offload" mode "C++ functions may be called, but C++ classes cannot be transfered" and

This focus on flat, or noncomplex data structures allows us to precisely specify what blocks of data need to be transferred to and from the coprocessor. Of course, data that is not exchanged has no restrictions and can be arbitrarily complex, including multidimensional arrays, C++ classes of any types, and any composition of data structures using pointers, arrays, and structs.

In the "Shared VM model" there are no such limitations, you can both use classes at MIC side and access them from MIC.

于 2014-03-20T17:44:08.867 回答