Strange Syntax
-
I saw this code snippet on a web page that was talking about CUDA[^] cores: Does anyone know the meaning of the syntax on the third line where they call the
kernel
function with those greater-than and less-than signs?dim3 blockDim(16, 16, 1);
dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1);
kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width);// Unbind the array from the texture
cudaUnbindTexture(tex);
} //end foo()__global__ void kernel(float* odata, int height, int width)
{
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
if (x < width && y < height) {
float c = tex2D(tex, x, y);
odata[y*width+x] = c;
}
}The difficult we do right away... ...the impossible takes slightly longer.
-
I saw this code snippet on a web page that was talking about CUDA[^] cores: Does anyone know the meaning of the syntax on the third line where they call the
kernel
function with those greater-than and less-than signs?dim3 blockDim(16, 16, 1);
dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1);
kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width);// Unbind the array from the texture
cudaUnbindTexture(tex);
} //end foo()__global__ void kernel(float* odata, int height, int width)
{
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
if (x < width && y < height) {
float c = tex2D(tex, x, y);
odata[y*width+x] = c;
}
}The difficult we do right away... ...the impossible takes slightly longer.
It is an extension of the NVIDIA CUDA compiler (see "Introduction to CUDA C"[^]:
Triple angle brackets mark a call from host code to device code — Sometimes called a “kernel launch”
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite
-
It is an extension of the NVIDIA CUDA compiler (see "Introduction to CUDA C"[^]:
Triple angle brackets mark a call from host code to device code — Sometimes called a “kernel launch”
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite
Thank you.
The difficult we do right away... ...the impossible takes slightly longer.
-
Thank you.
The difficult we do right away... ...the impossible takes slightly longer.
You are welcome.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite