Targetting specific cards at runtime

Targetting specific cards at runtime

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?

7 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

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)

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.

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.

Ah, that would explain a lot. What is the timeframe for it being included in the Windows version of the compiler?

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

Refer to this thread for some info about Windows support.

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen