Hi guys
I have an app that uses a kernel of 2 blocks and 20 threads per block.
Now, I need that each thread executes a function each 3 seconds. So that, what I need know is how can I use a timer into the kernel.
is this possible?
Thanks
Hi guys
I have an app that uses a kernel of 2 blocks and 20 threads per block.
Now, I need that each thread executes a function each 3 seconds. So that, what I need know is how can I use a timer into the kernel.
is this possible?
Thanks
Please, have a look at
[url]sleep - Equivalent of usleep() in CUDA kernel? - Stack Overflow
Perhaps it answers your question.
You could have the host run a timer and update a volatile zero-copy memory location, and GPU threads poll it. This is a really lousy idea, but it would work with accuracy on the order of 0.01 second.
You could use clock64() inside the kernel to very precisely measure elapsed clock ticks. But this isn’t measured in seconds, and different GPUs have different clock rates.
Side note: If you’re writing kernels that have just 2 blocks with just 20 threads, you’re not likely using the GPU in a standard way anyway, so you’re probably just experimenting.
Hello SPWorley
It’s true, im just experimenting because I really need use more blocks and threads per block
Im will try your method. If this works, I’ll tell you.
Thank you
Hello JFSebastian
Ooh that’s good.
I’ll try this method too.
Thanks