CUDA tutorial: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 87: Line 87:
* Constant memory
* Constant memory


= Few Basic CUDA Operations =
== CUDA Memory Allocation
* cudaMalloc((void**)&array, size)
** Allocates object in the device memory. Requires address of a pointer of allocated array and size.
* cudaFree(array)
** Deallocates object from the memory. Requires just a pointer to the array.


== CUDA Data Transfers ==
* cudaMemcpy(array_dest, array_orig, size, direction)
** Copy the data from either device to host or host to device . Requires pointers to the arrays, size and the direction type (cudaMemcpyHostToDevice, cudaMemcpyDeviceToHost, cudaMemcpyDeviceToDevice, etc)


= First CUDA C Program=
= First CUDA C Program=
Bureaucrats, cc_docs_admin, cc_staff
337

edits