Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16597 Discussions

compile and run issues of Hello world

Altera_Forum
Honored Contributor II
1,570 Views

Hello, 

 

I downloaded Quartus Prime Standard Edition 16.0 for Linux, and the Hello world from https://www.altera.com/support/support-resources/design-examples/design-software/opencl/hello-world.html. I ran into two issues: (1) in comping for the host, there is an error saying "bin/hello_world is a directory"; (2) After I changed the target in Makefile to some other name like "hello" instead, it compiles. Then it runs and shows "CL_DEVICE_NOT_FOUND".  

 

Here are the commands: 

 

$ aoc -march=emulator device/hello_world.cl -o bin/hello_world.aocx --board s5_ref 

$ make  

make: Nothing to be done for 'all'. 

$ ./bin/hello_world 

bash: ./bin/hello_world: is a directory 

$ ls bin/hello_world 

hello_world.1.bc hello_world.bc hello_world.cl.orig hello_world.log libkernel.so sys_description.legend.txt sys_description.txt 

$ vi Makefile # here i change target := hello_world to target := hello 

$ make  

../common/src/AOCLUtils/opencl.cpp: In function ‘void* aocl_utils::alignedMalloc(size_t)’: 

../common/src/AOCLUtils/opencl.cpp:55:49: warning: ignoring return value of ‘int posix_memalign(void**, size_t, size_t)’, declared with attribute warn_unused_result [-Wunused-result] 

posix_memalign (&result, AOCL_ALIGNMENT, size); 

../common/src/AOCLUtils/opencl.cpp: In function ‘bool aocl_utils::setCwdToExeDir()’: 

../common/src/AOCLUtils/opencl.cpp:278:14: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result] 

chdir(path); 

$ ./bin/hello 

Querying platform for info: 

========================== 

CL_PLATFORM_NAME = Altera SDK for OpenCL 

CL_PLATFORM_VENDOR = Altera Corporation 

CL_PLATFORM_VERSION = OpenCL 1.0 Altera SDK for OpenCL, Version 16.0 

 

error: cl_device_not_found  

Location: ../common/src/AOCLUtils/opencl.cpp:354 

Query for number of devices failed 

 

Here is my system (running inside VirtualBox): ubuntu 16.04 LTS 64-bit, Intel® Core™ i5-5300U CPU @ 2.30GHz, Graphics: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits). 

 

Thanks! 

Hongbo
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
527 Views

Hi Hongbo, 

 

Check out the Getting Started Guide for instructions on how to get up and running with the emulator flow. Have you set the CL_CONTEXT_EMULATOR_DEVICE_ALTERA environment variable? I believe you will need that in order to emulate an OpenCL FPGA device. I suspect that's where your error is coming from. 

 

https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/hb/opencl-sdk/aocl_getting_started.pdf 

 

Thanks for reporting the Makefile issue (hello_world vs. hello). I'll file a bug report to have someone look into it.
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Thanks for the timely help. That works! 

Hongbo
0 Kudos
Reply