# CUDA1: Introduction to cuda programming model ###### tags: `CUDA` `Multithread` ![](https://i.imgur.com/1CZEjDu.png) **gid = tid + blockIdx.x * blockDim.x** ## Memory transfer between host and device ![](https://i.imgur.com/xFoDVMJ.png) ![](https://i.imgur.com/0yNO2VF.png) Due to memory is seperated phisically, you have to transfer memory to times when using cuda. ### How? #### 1. Memory Copy ```c++= cudaMemCpy (destination ptr, sourse ptr, size in byte, direction ) ``` Direction Host to device – cudamemcpyhtod Device to host – cudamemcpydtoh Device to device - cudamemcpydtod #### 2. Memory management ![](https://i.imgur.com/vuewjqw.png) ## Important concept: