Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
818 Views

Does clCreateProgramWithSource work?

I tried the example from the programming guide and got a status = 0, but then failures. 

 

status: 0 clCreateProgramWithSource 

status: -33 clBuildProgram 

status: -45 clCreateKernel pipe_writer 

status: -45 clCreateKernel pipe_reader 

 

Nothing appears to actually be done on the clCreateProgramWithSource call. 

Anyone know if it works? 

 

I find that it would be extremely useful for handing frameworks like Caffe or benchmarks like SHOC where  

the kernels are dynamically created at run time. One could generate them, and compile for emulation and 

be able to run the code. Then afterwards go ahead an properly compile to bitstreams and use the aocx files. 

 

Thanks, 

 

Dan..
0 Kudos
4 Replies
Altera_Forum
Honored Contributor I
38 Views

It most certainly doesn't work and most likely never will. If you are talking about the example in Section 1.6.5.5.1 of the document, it is supposed to be an example of how you should edit your host code for it to be compatible with other OpenCL SDKs, which will of course not work on FPGAs. 

 

Even though you raise a valid point, the emulator is supposed to emulate the behavior of the FPGA, while that call certainly doesn't work on the FPGA, and supporting it in the emulator will be incorrect emulation of FPGA behavior.
Altera_Forum
Honored Contributor I
38 Views

FPGAs have to be programmed with the kernel hardware ahead of runtime, so there is no way that clCreateProgramWithSource would work.

Altera_Forum
Honored Contributor I
38 Views

Actually I think that it would be very useful to have this capability. 

 

Not so much to create bitstreams, since the compile and place & route time is so long. 

However, there are cases where kernels are generated at run time by frameworks like Caffe. 

It is especially useful to capture those sources for later offline compiling and bitstream creation., 

and still continue running by creating an emulation mode aocx file. That would allow the 

capturing of all the generated kernels. 

 

Then after offline compile, rerun the app with the proper bitstreams and on real hardware. 

 

Dan..
Altera_Forum
Honored Contributor I
38 Views

Nobody in this forum has any control over Altera's decisions, you can open a support request through their support and request this feature. 

 

Still, I am not particularly sure why you even need to use Altera's emulator for this purpose, when you can do the same thing by running the code on a standard CPU/GPU. There is not much of a reason to use Altera's emulator unless you are compiling kernels with channels, since they do not work on CPUs/GPUs. For every other case, you can simply run your kernel on a standard CPU/GPU which will be much faster and will also give you much more accurate emulation of concurrency/parallelism; something that Altera's emulator is not capable of doing.