- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to offload some data onto the phi card and then I want my thread to sleep on the host for a few seconds but when I try to do so, I get the following error, the sleeping section is strictly on the host and is not offloaded to mic in anyway.
SomeFunction is executed by a separate thread.
----------------------------------------------------------------------------------------------------------------------------
int main()
{ thread t1 (SomeFunction); ti.join();
}
void SomeFunction()
{
auto start = std::chrono::high_resolution_clock::now();
#pragma offload_transfer target(mic:nn) \
in( g_in[startInd:numElems:1]: alloc_if(0) free_if(freeval) )
{}
auto elapsed = std::chrono::high_resolution_clock::now() - start;
long ms = (std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count())/1000.0;
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}
----------------------------------------------------------------------------------------------------------------------------
Now, when I compile this code I get the following error,
using the following command
----------------------------------------------------------------------------------------------------------------------------
icpc -lpthread -std=c++11 -openmp -vec-report=3 try5.cpp -o t5
------------------------------------------------------------------------------------------------------------------------
try5.cpp(166): error: *MIC* namespace "std::this_thread" has no member "sleep_for"
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
^
compilation aborted for try5.cpp (code 2)
----------------------------------------------------------------------------------------------------------------------------
Why do I get a MIC error ? why is icpc confusing between std and MIC namespaces ? am I doing something wrong here ? Kindly advise.
Thank you in advance
Sincerely,
AM
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When a source file contains offload language extensions (e.g. #pragma offload) the Intel compiler automatically compiles the file for both the host and coprocessor.
The *MIC* tag appears in all compiler diagnostic issued during the coprocessor compilation; it does not relate to a namespace.
The issue here is the lack of support for std::this_thread in the gcc 4.7 (experimental) used in conjunction with the coprocessor compilation. Your host has a version that supports this. I do not know which version of gcc support this, it may be 4.7.1.
Try using a #ifndef __MIC__ to exclude the specific problematic source line from the coprocessor compilation. The alternative is isolating the offload code into function in a separate source file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Kevin, will try doing what you suggested. Appreciate your help.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page