Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

nothing transferred from CPU to FPGA

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 !

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have only created one queue,as following:

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

    checkError(status, "Failed to create command queue")