Quantcast
Channel: Intel® Many Integrated Core Architecture
Viewing all articles
Browse latest Browse all 1347

*MIC* namespace "std::this_thread" has no member "sleep_for"

$
0
0

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


Viewing all articles
Browse latest Browse all 1347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>