Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Question of MIC support STL?

yu__frank
Beginner
712 Views

Hello All,

I tried to use STL(vector) in offload mode . In fact it runs successfully. 

But I still have a question, for example:

#pragma offload_attribute(push, target(mic) )
#include <vector>
#pragma offload_attribute(pop)

struct TA {
int a;
int b;
}

int main(int argc, char* argv[])
{
    std::vector<TA> test_vec_ta;
    Ta ta1(1, 2);
     test_vec_ta.push_back(ta1);

#pragma offload target(mic)
{
    std::vector<int> test_vec_int;
    test_vec_int.push_back(11);
    test_vec_int.push_back(22);
}
    return 0;
}

 

When I compile, ICC has an error。This means that the struct TA needs to be shared .

My question is, the struct TA is not used in offload code block, why must set it to share.

0 Kudos
2 Replies
Rajiv_D_Intel
Employee
712 Views

I had to modify your test-case to make it compile. See attachment.

In any case, the warning message you see should not be produced, but can be safely ignored.

The message can be avoided by moving the #pragma offload_attribute(pop) below the definition of TA.

 

0 Kudos
yu__frank
Beginner
712 Views

Hi Rajiv .

Thank your response.

I think TA is not used in offload code block, why must set it to share?

The ICC need fix it, I think. ^_^

0 Kudos
Reply