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

createprogramwithbinary fails with "can't find handle to kernels in emulator object"

Altera_Forum
Honored Contributor II
1,039 Views

Hello, 

 

I'm new to Intel/Altera's OpenCL SDK. I have an existing application that works with NVIDIA's SDK and am trying to port that to run on Intel's FPGA emulator. 

I've compiled my kernel(s) using aoc and am attempting to load them into my application with clCreateProgramWithBinary (for the GPU I loaded the source 

and compiled them at run time). However, my first attempt at doing this results in the error "Error: Can't find handle to kernels in emulator object." immediately followed by a seg fault - the call to clCreateProgramWithBinary never returns. 

 

As specified in the docs, I've got: 

 

export CL_CONTEXT_EMULATOR_DEVICE_ALTERA=1 

 

I think I'm doing the setup of the device correctly, for instance I get: 

 

Have 1 platforms. 

Platform 0 (id=101779552) is: Intel(R) FPGA SDK for OpenCL(TM) 

Called clGetDeviceIDs OK 

Have 1 devices 

Device 0 is: EmulatorDevice : Emulated Device, type=8, version=OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 17.0 

 

so my querying of the device seems to work. 

 

In case it helps, the output of valgrind for the failing run is: 

 

Error: Can't find handle to kernels in emulator object. 

==17357== Invalid read of size 8 

==17357== at 0x4E7F8B8: l_load_binary_pkg (in /MyInstalls/intelFPGA/17.0/hld/host/linux64/lib/libalteracl.so

==17357== by 0x4E81589: clCreateProgramWithBinaryIntelFPGA (in /MyInstalls/intelFPGA/17.0/hld/host/linux64/lib/libalteracl.so

==17357== by 0x406664: get_binary_kernel(_cl_context**, _cl_device_id**, char*) (opencl_utils.c:239) 

==17357== by 0x4062C8: get_kernel(_cl_context**, _cl_device_id**, char*, char*, char*) (opencl_utils.c:140) 

==17357== by 0x402273: main (nemolite2d.c:331) 

==17357== Address 0x0 is not stack'd, malloc'd or (recently) free'd 

==17357==  

==17357==  

==17357== Process terminating with default action of signal 11 (SIGSEGV): dumping core 

==17357== Access not within mapped region at address 0x0 

==17357== at 0x4E7F8B8: l_load_binary_pkg (in /MyInstalls/intelFPGA/17.0/hld/host/linux64/lib/libalteracl.so

==17357== by 0x4E81589: clCreateProgramWithBinaryIntelFPGA (in /MyInstalls/intelFPGA/17.0/hld/host/linux64/lib/libalteracl.so

==17357== by 0x406664: get_binary_kernel(_cl_context**, _cl_device_id**, char*) (opencl_utils.c:239) 

==17357== by 0x4062C8: get_kernel(_cl_context**, _cl_device_id**, char*, char*, char*) (opencl_utils.c:140) 

==17357== by 0x402273: main (nemolite2d.c:331) 

 

So it looks like I have a null pointer. I'm at a loss as to what I'm doing wrong (it's probably something simple). Does anyone have any ideas? 

 

Many thanks, 

 

Andy.
0 Kudos
0 Replies
Reply