Community
cancel
Showing results for 
Search instead for 
Did you mean: 
okramer
New Contributor I
741 Views

OpenCL runtime error -42 (CL_INVALID_BINARY) trying to instantiate cl::Program object.

Jump to solution

I created a simple OpenCL application with a trivial FPGA kernel to verify the build/run process, but am getting a -42 error code returned from the cl::Program constructor. Here's a snippet of the host:

// Read kernel binary (compiled with "aoc -v -board=a10gx_hostpipe pipes.cl"): std::ifstream aocx_stream("pipes.aocx", std::ios::in|std::ios::binary); checkErr(aocx_stream.is_open() ? CL_SUCCESS:-1, "Opening pipes.aocx"); std::string progBuf(std::istreambuf_iterator<char>(aocx_stream), (std::istreambuf_iterator<char>())); cl::Program::Binaries binaries; binaries.push_back(std::make_pair((const void*)progBuf.c_str(), progBuf.length()));   // Create the Program from the AOCX binary: cl::Program program(context, DeviceList, binaries, NULL, &err); // RETURNS err=-42 checkErr(err, "Program Constructor"); // THROWS EXCEPTION  

When I use the emulation platform/device with the aocx binary compiled for that target, the code above works. But when I try it using the h/w platform/device, it fails with -42. I compiled pipes.cl with the command:

aoc -v -board=a10gx_hostpipe pipes.cl

I was successful programming the device from the command line with

$ aocl program acl0 ./pipes.aocx aocl program: Running program from /home/okramer/intelFPGA_pro/19.3/hld/board/a10_ref/linux64/libexec Programming device: a10gx : Arria 10 Reference Platform (acla10_ref0) MMD INFO : [acla10_ref0] Quartus versions for base and import compile do not match MMD INFO : [acla10_ref0] Board is currently programmed with sof from Quartus 19.3.0 171 MMD INFO : [acla10_ref0] PR import was compiled with Quartus 19.3.0 222 MMD INFO : [acla10_ref0] Reprogram the device with data saving and restoring MMD INFO : [acla10_ref0] Trying Partial Reconfiguration MMD INFO : [acla10_ref0] Quartus versions for base and import compile do not match MMD INFO : [acla10_ref0] Board is currently programmed with sof from Quartus 19.3.0 171 MMD INFO : [acla10_ref0] PR import was compiled with Quartus 19.3.0 222 MMD INFO : [acla10_ref0] Trying Full-Chip Reconfiguration (JTAG) MMD INFO : JTAG Autodetect device found Cable:1 , Device Index:1 MMD INFO : setting Cable to autodetect value 1 MMD INFO : setting Device Index to autodetect value 1 MMD INFO : executing "quartus_pgm -c 1 -m jtag -o "P;reprogram_temp.sof@1"" Info: ******************************************************************* Info: Running Quartus Prime Programmer Info: Version 19.3.0 Build 222 09/23/2019 SC Pro Edition Info: Copyright (C) 2019 Intel Corporation. All rights reserved. Info: Your use of Intel Corporation's design tools, logic functions Info: and other software and tools, and any partner logic Info: functions, and any output files from any of the foregoing Info: (including device programming or simulation files), and any Info: associated documentation or information are expressly subject Info: to the terms and conditions of the Intel Program License Info: Subscription Agreement, the Intel Quartus Prime License Agreement, Info: the Intel FPGA IP License Agreement, or other applicable license Info: agreement, including, without limitation, that your use is for Info: the sole purpose of programming logic devices manufactured by Info: Intel and sold by Intel or its authorized distributors. Please Info: refer to the applicable agreement for further details, at Info: https://fpgasoftware.intel.com/eula. Info: Processing started: Thu Jan 9 17:22:26 2020 Info: System process ID: 15973 Info: Command: quartus_pgm -c 1 -m jtag -o P;reprogram_temp.sof@1 Info (213045): Using programming cable "USB-BlasterII [1-5]" Info (213011): Using programming file reprogram_temp.sof with checksum 0x30EEE395 for device 10AX115S2F45@1 Info (209060): Started Programmer operation at Thu Jan 9 17:22:31 2020 Info (209016): Configuring device index 1 Info (209017): Device 1 contains JTAG ID code 0x02E660DD Info (209007): Configuration succeeded -- 1 device(s) configured Info (209011): Successfully performed operation(s) Info (209061): Ended Programmer operation at Thu Jan 9 17:22:46 2020 Info: Quartus Prime Programmer was successful. 0 errors, 0 warnings Info: Peak virtual memory: 2527 megabytes Info: Processing ended: Thu Jan 9 17:22:46 2020 Info: Elapsed time: 00:00:20 Info: System process ID: 15973 Program succeed.

 

I asked a related question as a follow-up to previous posting here: https://forums.intel.com/s/question/0D70P000006e8m7SAA. I'm not sure it's relevant.

 

0 Kudos
1 Solution
okramer
New Contributor I
558 Views

UPDATE: After doing the command line programming above, the OpenCL app doesn't complain at the cl::Program instantiation anymore. The app is now working. Magic.

View solution in original post

2 Replies
okramer
New Contributor I
559 Views

UPDATE: After doing the command line programming above, the OpenCL app doesn't complain at the cl::Program instantiation anymore. The app is now working. Magic.

View solution in original post

MEIYAN_L_Intel
Employee
558 Views

Hi,

 

It might be due to the board is not match then the binary generated for the FPGA is not the correct one.

 

Thanks

Reply