Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Building the Source Code

$
0
0

In this step, you will compile the source code into an application that runs on both the host and the target. After you compile and run the application, examine the output.

  1. Run the command make clean to make sure the directory is clean for a fresh build.

  2. Run the command make out/CrossFade to build all the utility modules and the sample CrossFade.

    The progress of the make command should appear similar to the following:

    $>make out/CrossFade
    icc -c  -o src/Util.o -I./src src/Util.cpp
    icc -c  -o src/Properties.o -I./src src/Properties.cpp
    icc -c  -o src/main.o -I./src src/main.cpp
    icc -c  -o src/PerfTimer.o -I./src src/PerfTimer.cpp
    mkdir out
    icc -c  -o src/Workloads/CrossFade/CrossFade.o -I./src src/Workloads/CrossFade/CrossFade.cpp
    icc -o out/CrossFade  src/Util.o src/Properties.o src/main.o src/PerfTimer.o src/Workloads/CrossFade/CrossFade.o -lrt
    $>
  3. Run the CrossFade application by invoking the application with the properties configuration file, as follows:

    $>out/CrossFade src/Workloads/CrossFade/crossfade.prop
    sptel28 166>out/CrossFade
    Workloads available:
     CrossFade
     CrossFade_ints
    
    This program is built with __INTEL_OFFLOAD,
    so it will execute with offload to Intel graphics or not depending on "exec" mode (cpu|offload).
    
    executing workload: CrossFade
    
    <config>
     exec = offload
     cpu_share = 0
     validate = true</config>
    
    exec mode is offload
    
    …
    
    passed
    

    The following message should appear:

    This program is built with __INTEL_OFFLOAD

    This statement indicates that the sample code was compiled into an application that runs both on the host and the target.

Note the best time per iteration, which is displayed at the end of the output. You will compare this time to the best time per iteration of the application when built to run on just the host.

In the next step, you will look at the source code to learn how to define which code section should run on the target and how the offload session is organized.

Open the Building the OpenMP Version topic

Inglés

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>