Building an Application to Run on the Host Only

In this step, you will compile the same code into an application that runs only on the host. You can use this step to compile an early version of your code, where the offload language extensions are ignored by the compiler, to ensure that the application runs correctly on just the host only. Once your application runs correctly on the host, you can compile the same code into an application that runs on both the host and target.

  1. Remove existing module files from the previous compilations by using the following command:

    rm -f *.mod

  2. Compile the source code using the following command:

    ifort -openmp -no-offload tbo_sort.F90 -o tbo_exe_CPU

    The no-offload option sets the compiler to ignore the offload language extensions and not define the __INTEL_OFFLOAD macro. The #ifdef directive contains the code block to detect the target and other target specific directives.

  3. Run the application using the following command.

    ./tbo_exe_CPU

Just as before, the application displays the first 20 values in ascending order and the first ten even, odd, and prime numbers. However, this version does not display the quantity of targets because the compiler ignored the code block for the #ifdef directive with the __INTEL_OFFLOAD macro.

This step is the last step in the tutorial.


Submit feedback on this help topic