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

Odd clBuildProgram function error

Altera_Forum
Honored Contributor II
1,622 Views

Hi everyone, 

I am actually working on implementing an existing GPU OpenCL benchmark on an FPGA. Recently I am stucked on a really strange problem: I am trying to run the simulation of one of the kernel of the frame-work and I succefully ended up with the .aocx file. Then I built the OpenCL environment (platform, context, device, program ...) in the benchmark host code, and when I come across the clBuildProgram function I had the error CL_BUILD_PROGRAM_FAILURE. So I have tried to use the clGetProgramBuildInfo function to get a log and find out the error but in this case the function was not even able to get the lenght of the log. Then I used the same .aocx in a host code of an example (made explicitily to run a simple OpenCL vector sum) and there the clGetProgramBuildInfo is not giving any errors. So basically that is the situation: the same .aocx file works in the example host code but not in the benchmark one. In addition, the code in the OpenCL enviroment setting in both host codes (benchmark and example) are the same. So I would like to know if somebody has an idea of where the problem could be. 

Thanks ahead.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
910 Views

Did you check to see if you're creating the program object the same was as the example host? If the example openCL vector sum clBuildProgram routine works, why don't you reuse that section of the code in your host? To build the openCL program, it's pretty much the same regardless of application at least for the Altera FPGAs. As to what the problem might me, my guess currently is how you're creating the cl_program object which you're trying to build the program from. Hope this helps

0 Kudos
Altera_Forum
Honored Contributor II
910 Views

Thanks for the help okebz. 

 

Anyway, how can I check if the program object is the same in both hosts? 

 

Moreover, I am actually using the same section of the code in both host codes, that's why the problem seems so strange.
0 Kudos
Altera_Forum
Honored Contributor II
910 Views

Oh I meant if the program object in both was created the same way, but if you're using the same section of code in both host, then i'm not too sure.  

 

The only thing I can think of is maybe the difference between GPU and FPGA. If your host code was targeting the GPU in the beginning, there is some difference as to what you need to do when you target the FPGA. For example, when building the program object, you have to create the program object from binary when working with the .aocx file as opposed to GPU where you can build the program object from source.
0 Kudos
Altera_Forum
Honored Contributor II
910 Views

Unfortunately for me, I am also using the same code to set device,context,platform and program, and this code is for an FPGA application. That's why this is driving me crazy!

0 Kudos
Altera_Forum
Honored Contributor II
910 Views

Last thing that I can probably think of is how you compile it. There was an instance that I encountered where two identical .aocx and host program were compiled, but one found the altera platform and the other didn't, but the only difference between the two was how it was compiled. There was a flag set on one of them that I'm guessing made the compiler use a different set of libraries. Changing the make file to the same fixed the issue. Not the same as the error you're encountering, but maybe the fix is similar.

0 Kudos
Altera_Forum
Honored Contributor II
910 Views

I was thinking to same thing. So now that you are telling me this, it is quite possible that the error is in the compilation step. In fact the two host codes use two different makefiles. 

Thanks so much for the advice.
0 Kudos
Reply