Software Archive
Read-only legacy content
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
17065 Discussions

support for OpenMP of Xeon Phi



I am using Intel(R) Visual Fortran Compiler XE, Version 1, for an application wich has simple OpenMP parallel do loops. I am wondering if I need to modify the code if I instal Xeon Phi on my PC, in order to have access to more processors. What will be the return of   OMP_GET_NUM_PROCS()?


0 Kudos
2 Replies

If you plan on using the coprocessor in the native execution mode then, in theory, you should be able to just recompiler your code with -mmic flags and run your applications on the coprocessor. In which case, the output of the OMP_GET_NUM_PROCS() would be equal to the number of processors on the Intel Xeon Phi coprocessor. 

However, if you want to use the coprocessor through an offload application (using the coprocessor + host), then you would need to do make some changes to your code to offload some work to the coprocessor. In this case, the output of the the OMP_GET_NUM_PROCS() would be different depending on whether it is called in an offloaded region or not. If you call the OMP_GET_NUM_PROCS in an offload then it will return the number of processors on coprocessor otherwise it will return the number of processors on the host. 

Black Belt

The default value you should get for num_procs would be 4 times number of cores for native execution, 4 times (numcores - 1) for offload.  You will almost certainly need to adjust affinity settings and number of threads, very likely stack settings (both global and thread stacks) as well.

In view of larger number of threads as well as vector register parallelism, longer loops are needed for effective performance on MIC.

You would likely be better off with a more up to date compiler.  I guess there have been at least 3 updates with bug fixes etc. as well as new affinity control schemes.