Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yu__frank
Beginner
36 Views

Question of MIC support STL?

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
36 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.

 

yu__frank
Beginner
36 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. ^_^

Reply