Intel® FPGA RTE for OpenCL™ Pro Edition: Getting Started Guide

ID 683173
Date 9/26/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

2.7.1. Building the Host Application

The <local_path_to exm_opencl_hello_world>\hello_world\hello_world.sln file contains the host solution. After you open this .sln file in Microsoft Visual Studio, you can build the OpenCL™ host application in the main.cpp file.
If you are using Microsoft Visual Studio, you need the FCD, and the Installable Client Driver (ICD) from Khronos. The ICD driver links the host against the OpenCL.dll, which requires the FPGA Client Driver (FCD) installed. For installing FCD, refer to Installing an FPGA Board.

To set up Microsoft Visual Studio with FCD and ICD, perform the following tasks prior to building the host application:

  1. Verify that you have set up FCD and ICD correctly using the aocl diagnose -icd-only command. If you have installed FCD and ICD correctly, you should see the following output:
    ICD System Diagnostics 
    -------------------------------------------------------------------- 
    Using the following location for ICD installation: 
    	HKEY_LOCAL_MACHINE\Software\Khronos\OpenCL\Vendors 
    
    Found 1 icd entry at that location: 
    	<INTELFPGAOCLSDKROOT>\windows64\bin\alteracl_icd.dll   REG_DWORD   0x0 
    
    Checking validity of found icd entries: 
    	<INTELFPGAOCLSDKROOT>\windows64\bin\alteracl_icd.dll   REG_DWORD   0x0 is 
    correctly registered on the system 
    
    Using the following location for fcd installations: 
    	HKEY_LOCAL_MACHINE\Software\Intel\OpenCL\Boards 
    
    Found 1 fcd entry at that location: 
    	<path_to_OpenCL_BSP>\a10_ref\windows64\bin\altera_a10_ref_mmd.dll 
    REG_DWORD 0x0 
    
    Checking validity of found fcd entries: 
    	<path_to_OpenCL_bsp>\a10_ref\windows64\bin\altera_a10_ref_mmd.dll 
    REG_DWORD 0x0 is correctly registered on the system 
    
    Number of Platforms = 1 
    	1. Intel(R) FPGA SDK for OpenCL(TM)             | Intel(R) Corporation | 
    OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version  <version_number>
    -------------------------------------------------------------------- 
    ICD diagnostics PASSED 
    --------------------------------------------------------------------
  2. If you have not set up the FCD or ICD correctly, refer to the Installing an FPGA Board for FCD setup, and refer to the Accessing Custom Platform-Specific Functions and Linking Your Host Application to the Khronos ICD Loader Library sections of the Intel FPGA SDK for OpenCL Pro Edition Programming Guide for more information.
  3. Link the host application to the OpenCL.lib library.
    1. Under the Solution, right-click the host application name and select Properties, and then select Configuration Properties > Linker > Input.
    2. In the Additional Dependencies field, enter OpenCL.lib.
    Attention: Because you are using FCD and ICD, do not link the host program to alteracl.lib or to your Custom Platform's MMD libraries directly.
To build the hello_world host application, perform the following tasks:
  1. Open the <local_path_to_exm_opencl_hello_world>\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 is in the <local_path_to_exm_opencl_hello_world>\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.