cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
455 Views
Registered: ‎06-14-2018

Host code, what is the finish() purpose ?

Jump to solution

Hi,

After the kernel is executed, and the result retrieved, what finish() does ?

I would like to bench the memory transfers, and I wonder if I have to count this one.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Xilinx Employee
Xilinx Employee
445 Views
Registered: ‎03-24-2010

回复: Host code, what is the finish() purpose ?

Jump to solution

clEnqueue* commands just push commands into command queue, and then immediately return to host. clFinish is to make sure commands in command queue to finish.

FYI.

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

View solution in original post

4 Replies
Highlighted
Xilinx Employee
Xilinx Employee
446 Views
Registered: ‎03-24-2010

回复: Host code, what is the finish() purpose ?

Jump to solution

clEnqueue* commands just push commands into command queue, and then immediately return to host. clFinish is to make sure commands in command queue to finish.

FYI.

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

View solution in original post

Highlighted
Explorer
Explorer
415 Views
Registered: ‎06-14-2018

回复: Host code, what is the finish() purpose ?

Jump to solution

Because I would like to do some benchs, especially about memory transfers, hence the code:

clock_gettime(CLOCKTYPE, &ts1);
		//Copy input data to device global memory
		q.enqueueMigrateMemObjects(inBufImg,0);
		int nargs=0;

		sobel.setArg(nargs++,buffer_img_in);
		sobel.setArg(nargs++,buffer_img_out);

clock_gettime(CLOCKTYPE, &ts2);
		//Launch the Kernel
		q.enqueueTask(sobel);

clock_gettime(CLOCKTYPE, &ts3);
		//Copy Result from Device Global Memory to Host Local Memory
		q.enqueueMigrateMemObjects(outBufImg,CL_MIGRATE_MEM_OBJECT_HOST);
		q.finish();

clock_gettime(CLOCKTYPE, &ts4);

I wonder if I have to put the ts4 before or after the q.finish to get a right value.

 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
399 Views
Registered: ‎03-24-2010

回复: Host code, what is the finish() purpose ?

Jump to solution

Put the ts4 after the q.finish to get a right value.

Regards,
brucey
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
Highlighted
Explorer
Explorer
391 Views
Registered: ‎06-14-2018

回复: Host code, what is the finish() purpose ?

Jump to solution

Ok, thanks for your answers.

0 Kudos