Software Archive
Read-only legacy content
17061 Discussions

Targetting specific cards at runtime

Michael_H_7
Beginner
732 Views

I have a question about targetting specific Intel Phi cards at runtime (assuming you have more than one card installed in a machine). I've seen in the documentation that you can do #pragma offload target(mic) which seems to amount to "any available MIC", and you can also do #pragma offload target(mic:0) which is specifically device 0, but a compile time choice. How do you turn that into a variable to target mic:X where X is not known until runtime? Also, how do you query the system to find out how many MICs are available and what their device #s are?

0 Kudos
6 Replies
Kevin_D_Intel
Employee
732 Views
For C/C++, include offload.h and call the _Offload_number_of_devices() (C++) API. For Fortran, USE mic_lib and call OFFLOAD_NUMBER_OF_DEVICES() (Fortran) API. There are also APIs to return the coprocessor on which the offload is running: _Offload_get_device_number() (C++) and OFFLOAD_GET_DEVICE_NUMBER() (Fortran) For run-time coprocessor selection, use an int variable, or integer expression, for target-number whose value is assigned at run-time. int x; ... x = 1; ... #pragma offload target (mic: x) ... x = 0; ... #pragma offload target (mic: x) ...
0 Kudos
Michael_H_7
Beginner
732 Views
That sounds simple enough, thank you. In follow-up though, I have seen a lot of reference to "offload.h" that you mention in several documents, but I do not seem to have such a file on my computer. I have installed C Studio XE 2013 (Windows version). OpenMP stuff is compiling fine (I can include omp.h) but cannot seem to include offload.h or use any of the offload-related things (for example putting __attribute((target(mic))) on a function). I'm guessing there is something straight-forward I am missing (like a compile switch somewhere? I am using Visual Studio 2008). Any help would be appreciated. Thanks.
0 Kudos
Charles_C_Intel1
Employee
732 Views
At present you'll only find offload.h (in /compiler/include>) in the Linux version of Intel(r) Composer XE, as Intel(r) Xeon Phi(tm) isn't supported on Windows yet. Sorry, Charles
0 Kudos
Michael_H_7
Beginner
732 Views
Ah, that would explain a lot. What is the timeframe for it being included in the Windows version of the compiler?
0 Kudos
Charles_C_Intel1
Employee
732 Views

Unfortunately, that's not a question I can answer at this time.  :-(

0 Kudos
Kevin_D_Intel
Employee
732 Views

Refer to this thread http://software.intel.com/en-us/forums/topic/337513 for some info about Windows support.

0 Kudos
Reply