Running native application on Xeon-Phi

Home

There are two ways for running native code on Intel Xeon Phi coprocessors:
  1. The user can log into the coprocessor using ssh and use the shell to run the application on the Phi coprocessor;
  2. or the user can use the micnativeloadex utility from Xeon. It copies the native binary from Xeon to a specified MIC (Phi coprocessor) and execute it. In addition, micnativeloadex automatically checks library dependencies for the application, and, if they can be located, these libraries are also copied to the device prior to execution.
The user can transfer the executable to the coprocessor using the secure copy tool scp tool. After that, the user can log into the coprocessor using ssh and use the shell to run the application on the coprocessor.

Before you log into the MIC, you can configure environment variables, such as KMP_AFFINITY in this way:

export KMP_AFFINITY="balanced"

In this example the coprocessor (PHI/MIC) will recognize that thread affinity was set to "balanced"

Library Dependence on MIC

If there is some issue about libraries dependency when you try to run native application by log into MIC, you have to copy the missing library to MIC. For this, go to Xeon and make copy from there.


Example:

From Xeon execute the following commands:
  1. Locate library_name
  2. scp -r /full_path/library_name mic0:~/
  3. connect to mic: ssh mic0
  4. execute you program: ./program_name arg1 arg2
Where:
library_name is the name of the missing library that you program requested.
full_path is the complete path where is you missing library.


From the Xeon host, execute this following command:

        micnativeloadex ./myprogram -a "arg1 arg2" -e “environment_variable=value”

When you choose to run a native application through the micnativeloadex, you can configure the environment variables, such as KMP_AFFINITY, by using the parameter "-e".

Example:

micnativeloadex ./cge1 -a "60 10" -e "KMP_AFFINITY=balanced"

In this example, cge1 will run with two parameters (60 and 10, that are matrix size and number of threads respectively) and set thread affinity to "balanced".

        options:

            -a “arg1, arg2, argn”: place the arguments od your code.
            -e "environment_variable" : An optional environment string to pass to the remote app.

       Multiple environment variables may be specified by using spaces as separators.

Library Dependence on micnativeloadex

If micnativeloadex detects some libraries dependence, then we have to update the SINK_LD_LIBRARY_PATH environment  variable to include the path of the missing libraries. For this, use the following command from the Xeon host:

            export SINK_LD_LIBRARY_PATH=$SINK_LD_LIBRARY_PATH:/PATH_1:/PATH_2:/PATH_N