Host calls the compute function in every frame to execute ‘bind-call kernel-unbind’.
Inside the kernel function, I modify the content of the ‘mybuffer’.
I’m wondering which case is correct.
case1)
void compute(…)
{
cudaBindTexture(0, texref, mybuffer, desc, size );
//call kernel
K_compute<<numBlocks, numThreads>>( mybuffer );
cudaUnbindTexture( 0, texref );
}
case2)
cudaBindTexture(0, texref, mybuffer, desc, size ); // bind once at initialization
//call compute for several times
void compute(…)
{
//call kernel
K_compute<<numBlocks, numThreads>>( mybuffer );
}
cudaUnbindTexture( 0, texref ); // unbind at program termination
Does ‘bind’ mean sharing pointer(or reference) of certain memory?