X hits on this document

Powerpoint document

The Missouri S&T CS GPU Cluster - page 12 / 18

38 views

0 shares

0 downloads

0 comments

12 / 18

Template of a typical main()

int main(int argc, char** argv)

{

 // Allocate memory on the host for input data - malloc()

 // Initialize input data from file, user input, etc.

 // Allocate memory on the device - cudaMalloc()

 // Send input data to the device - cudaMemcpy()

 // Set up grid and block dimensions - dim3 variables

 // Invoke the kernel on the device (GPU) -

 kernelName<<<gridSize, blockSize>>>(input_params);

 // Copy results from device to host - cudaMemcpy()

 // Free up device memory - cudaFree()

 // Print results at the host, because device can’t.

 // printf() from kernel only works in emulation mode

}

Document info
Document views38
Page views38
Page last viewedThu Dec 08 05:04:34 UTC 2016
Pages18
Paragraphs213
Words1253

Comments