Forum Discussion

PJang's avatar
PJang
Icon for New Contributor rankNew Contributor
7 years ago

Hello World Design Example Error (-1001)

I'm trying to run the hello world example, but when attempting to run the host executable from the hello world directory using the command:

CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 bin/host

I see the following error message:

ERROR: UNRECOGNIZED ERROR CODE (-1001)
Location: ../common/src/AOCLUtils/opencl.cpp:297 
Query for number of platforms failed

Steps to Reproduce

After installing Intel Quartus Pro, I followed the steps in the documentation below, starting from "Installing a custom FPGA" board for a linux machine.

https://www.intel.com/content/www/us/en/programmable/documentation/mwh1391807309901.html#ewa1421439650367

I skipped the Enabling Backwards Compatibility section and went to the Verifying Host Runtime Functionality via Emulation section.

I set QUARTUS_ROOTDIR_OVERRIDE to where quartus pro was installed to

[patrickjang@localhost hello_world]$ echo $QUARTUS_ROOTDIR_OVERRIDE
/home/patrickjang/intelFPGA_pro/18.1/quartus

As well as LD_LIBRARY_PATH

[patrickjang@localhost hello_world]$ echo $LD_LIBRARY_PATH
/home/patrickjang/intelFPGA_lite/18.1/hls/host/linux64/lib/:/home/patrickjang/intelFPGA_pro/18.1/hld/host/linux64/lib:/home/patrickjang/intelFPGA_pro/18.1/hld/board/nalla_pcie_hostch/linux64/lib:/home/patrickjang/intelFPGA_pro/18.1/hld/host/linux64/lib:/home/patrickjang/intelFPGA_pro/18.1/hld/board/nalla_pcie_hostch/linux64/lib

Downloaded the Hello World example project for linux and entered the directory

Compiled a kernel for emulation

[patrickjang@localhost hello_world]$ aoc -march=emulator -v device/hello_world.cl -o bin/hello_world.aocx
 
aoc: Environment checks are completed successfully. 
aoc: Cached files in /var/tmp/aocl/patrickjang may be used to reduce compilation time 
You are now compiling the full flow!! 
aoc: Selected default target board p385a_mac_hostch_ax115 
aoc: Running OpenCL parser.... 
aoc: OpenCL parser completed successfully. 
aoc: Linking Object files.... 
aoc: Compiling for Emulation .... 
aoc: Emulator Compilation completed successfully. 
Emulator flow is successful. 
To execute emulated kernel, invoke host with  
   env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 <host_program> 
 For multi device emulations replace the 1 with the number of devices you wish to emulate

I then built the host application using the make command.

Heres what's in my bin directory:

[patrickjang@localhost hello_world]$ ls bin
hello_world            hello_world.32130.temp hello_world.aocr host
hello_world.32080.temp hello_world.aoco       hello_world.aocx

Next, I run "aocl linkflags" but am unsure with what to do with this information. Here's the output.

[patrickjang@localhost hello_world]$ aocl linkflags
-L/home/patrickjang/intelFPGA_pro/18.1/hld/host/linux64/lib -lOpenCL

Finally I run "env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 bin/host, which shows the aforementioned error message below:

[patrickjang@localhost hello_world]$ env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 bin/host
ERROR: UNRECOGNIZED ERROR CODE (-1001)
Location: ../common/src/AOCLUtils/opencl.cpp:297
Query for number of platforms failed
 

Here's my aocl list-devices and diagnosis output (the diagnose all doesn't return anything)

[patrickjang@localhost hello_world]$ aocl list-devices
--------------------------------------------------------------------
Warning:
No devices attached for package:
/home/patrickjang/intelFPGA_pro/18.1/hld/board/nalla_pcie_hostch
--------------------------------------------------------------------
[patrickjang@localhost hello_world]$ aocl diagnose all

Here's how I setup my environment variables in my ~/.bashrc file

PATH=$PATH:$HOME/bin
 
export QUARTUS_ROOTDIR="/home/patrickjang/intelFPGA_pro/18.1/quartus"
 
export QSYS_ROOTDIR="/home/patrickjang/intelFPGA_pro/18.1/qsys/bin"
 
export INTELFPGAOCLSDKROOT="/home/patrickjang/intelFPGA_pro/18.1/hld"
 
export AOCL_BOARD_PACKAGE_ROOT=${INTELFPGAOCLSDKROOT}/board/nalla_pcie_hostch
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INTELFPGAOCLSDKROOT/host/linux64/lib:$AOCL_BOARD_PACKAGE_ROOT/linux64/lib
 
export PATH=$PATH:$INTELFPGAOCLSDKROOT/bin:$QUARTUS_ROOTDIR/bin:$QUARTUS_ROOTDIR/sopc_builder/bin
 
export QUARTUS_ROOTDIR_OVERRIDE="/home/patrickjang/intelFPGA_pro/18.1/quartus"

Please let me know if there are any other details I can provide. Any help would be greatly appreciated. Thanks!

4 Replies

  • HRZ's avatar
    HRZ
    Icon for Frequent Contributor rankFrequent Contributor

    From what I remember, this error happens when you do not have a compatible icd file located in "/etc/OpenCL/vendors/". If you install the OpenCL SDK as root, the icd driver is automatically installed, but if you install as a non-root user, you will have to copy the driver manually under the root account. Look for the icd file in *quartus_install_dir*/hld/ and copy it to the aforementioned path.

    • PJang's avatar
      PJang
      Icon for New Contributor rankNew Contributor

      Hey, thanks for the response!

      I definitely see the two icd files in my *quartus_install_dir*/hld directory (Altera.icd and Intel_FPGA_SSG_Emulator.icd). However when I peek into my /etc/ directory, both as a local user and root, I can't find any folder named OpenCL. Any idea why that directory might be missing and what I can do to resolve that? I'm on a RHEL 6 box if that helps.

      • HRZ's avatar
        HRZ
        Icon for Frequent Contributor rankFrequent Contributor

        That is expected if this is the first time you are installing an OpenCL SDK on your OS. Just create the folder yourself and copy both files there, that will very likely resolve your issue. Make sure everyone has read and execute access to the folder, though.