Executing an opencl kernel on an fpga, Building the host application, Running the host application – Altera RTE for OpenCL User Manual

Page 17: Output from successful kernel execution, Executing an opencl kernel on an fpga -8, Building the host application -8, Running the host application -8, Output from successful kernel execution -8

Advertising
background image

OpenCL Design Examples page on the Altera website

Executing an OpenCL Kernel on an FPGA

Build your OpenCL host application in Microsoft Visual Studio version 2010 Professional, and run the

application by invoking the

hello_world.exe

executable. The AOCL is compatible with 64-bit host binaries

only.

Building the Host Application

The

<path_to_exm_opencl_hello_world_x64_windows_<version>>\hello_world\hello_world.sln

file contains the

host solution. After you open this

.sln

file in Microsoft Visual Studio, you can build the host application in

the

main.cpp

file.

To build the host application, perform the following tasks:
1. Open the

<path_to_exm_opencl_hello_world_x64_windows_<version>>\hello_world\hello_world.sln

file in

Microsoft Visual Studio.

2. Verify that the build configuration is correct. The default build configuration is Debug, but you can

use Release. You must select the appropriate option as the solution platform (for example, for x64

architecture, select x64).

3. Build the solution by selecting the Build > Build Solution menu option, or by pressing the F7 key.

The

hello_world.exe

executable will be in the

<path_to_exm_opencl_hello_world_x64_windows_<version>>\

hello_world\bin

folder.

4. Verify that the build is correct. An output ending with a message similar to the one shown below

notifies you of a successful build:

1> Build succeeded.
1>
1> Time Elapsed 00:00:03:29
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Attention: You can ignore the

LNK4009: PDB 'vc90.pdb' was not found with...

warnings because they have no effect on the build. The compiler might issue this type of

warning messages if you have built your Windows libraries using a previous version of

Microsoft Visual Studio.

Running the Host Application

To execute the OpenCL kernel on the FPGA, run the Windows host application that you built from

the

.sln

file.

1. Add the path

%ALTERAOCLSDKROOT%\host\windows64\bin

to the PATH environment variable.

2. At a command prompt, navigate to the host executable within the

<path_to_exm_opencl_hello_world_x64_windows_<version>>\hello_world\bin

folder.

3. Invoke the

hello_world.exe

executable.

The

hello_world

executable executes the kernel code on the FPGA.

Output from Successful Kernel Execution

When you run the host application to execute your OpenCL kernel on the target FPGA, the RTE notifies

you of a successful kernel execution.

2-8

Executing an OpenCL Kernel on an FPGA

OCL005-15.0.0

2015.05.04

Altera Corporation

Getting Started with the Altera RTE for OpenCL for 64-Bit Windows

Send Feedback

Advertising