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

nothing transferred from CPU to FPGA

Altera_Forum
Honored Contributor II
1,593 Views

status = clEnqueueWriteBuffer(queue, d_OptionData_bino, CL_TRUE, 

0, NUM_OPT * sizeof(__TOptionData_Bino), h_OptionData_bino, 0, NULL, NULL); 

checkError(status, "Failed to transfer input A");  

 

status = clSetKernelArg(kernel, argi++, sizeof(cl_mem), (void*)&d_OptionData_bino); 

checkError(status, "Failed to set argument %d", argi - 1); 

 

h_OptionData_bino is the CPU input data structure,type is "__TOptionData_Bino", the values input are correct(printf tells),but nothing has been transferred to FPGA(also printf()).checkError function doesn't show anything. I was using a emulation aocx to run with exe without FPGA board, I do not know whether it matters.  

 

Can anyone help me?Thanks a lot !
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
657 Views

add event to clEnqueueWriteBuffer function, Events are used to ensure that the kernel is not launched until the writes to the input buffers have completed.

0 Kudos
Altera_Forum
Honored Contributor II
657 Views

This should not matter since if both commands are launched in the same queue, they WILL be run sequentially and the clEnqueueWriteBuffer will start and finish BEFORE the kernel is launched. Furthermore, passing CL_TRUE as the third argument of "clEnqueueWriteBuffer" forces the write operation to be blocking, and the host process will be locked until the host to device transfer is done. The only way the kernel might be launched before clEnqueueWriteBuffer finishes is if the two commands are launched in different queues.

0 Kudos
Altera_Forum
Honored Contributor II
657 Views

I have only created one queue,as following: 

queue = clCreateCommandQueue(context, device, CL_QUEUE_PROFILING_ENABLE, &status); 

checkError(status, "Failed to create command queue")
0 Kudos
Reply