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

Real time Counter in Kernel

Hi,  

I want to define a real time counter and print his result .  

Can I define Real time clock "i" in kernel and print the result of counter?. 

In Other hand, I thought that I define a counter "i" in my Kernel and I store My counter "i" in global memory and then I read buffer from Host. 

My question : Does this counter "i" defined in kernel works under real time FPGA clock ? 

If yes , How I can print the result of counter ? This code (below) doesn't work for me. 

Kernel ( 

__global uint *restrict Y, 

int Gid = get_global_id(0); 

i=i+1; 

Y[Gid]=i; 

Thank you.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor I
9 Views

There is no clock in OpenCL and there is no guarantee that your accumulation will happen once every clock. You will not be able to get clock-accurate timing results in OpenCL. However, you can get very accurate timing results (but not clock-accurate) by using OpenCL's built-in profiler: 

 

https://stackoverflow.com/questions/23550912/measuring-execution-time-of-opencl-kernels