Understanding cudaMemcpyToSymbol and cudaMemcpyFromSymbol

It seems common to use cudaMemcpyToSymbol and cudaMemcpyFromSymbol to link global device variables to a device memory block. However, I never saw any clear description about these functions. To make my questions clear, a little program is given below.

#include <stdio.h>

__device__ int *a;

__global__ void kernel()




int main()


  int *da;





int ha[1];


  printf("%d\n",ha[0]); // this output 3




My questions are:

  1. da itself is a pointer, so why &da?

  2. cudaMemcpyToSymbol’s default copy direction is cudaMemcpyHostToDevice. So da is treated as a host memory block? Obviously it’s not in host memory. So why NVIDIA do such way?

  3. cudaMemcpyFromSymbol cannot replace cudaMemcpyToSymbol in this example no matter using what argument combination, am I right? why I can’t do this?

  4. From reference manual, symbol here may mean variable name in some cases. Is it the only meaning of symbol here?