title: If cudaMalloc() allocates global memory, then why do I need cudaMemcpy()?
body: <p>I am learning cuda, and so far I have learned that cuda has <code>cudaMalloc()</code> function which allocates memory for a global object. But now in some matrix multiplication code, I have seen that they are using another function called <code>cudaMemcpy()</code> which copies an object from host to device or the other way around. But I do not understand why it is needed? Since <code>cudaMalloc()</code> is allocating global memmory, all the device cores should have access to it, shouldn't they?</p>
  
  <p>Where is my misunderstanding?</p>