UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
113 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
Xilinx Employee
Xilinx Employee
103 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.
----------------------------------------------------------------------------------------------
4 Replies
Xilinx Employee
Xilinx Employee
104 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.
----------------------------------------------------------------------------------------------
Explorer
Explorer
73 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
Xilinx Employee
Xilinx Employee
57 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.
----------------------------------------------------------------------------------------------
Explorer
Explorer
49 Views
Registered: ‎06-14-2018

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

Jump to solution

Ok, thanks for your answers.

0 Kudos