I am trying to copy an array of floats from the host to another array of floats on the device. This is how I did it :
// copy input array from the host (CPU) memory to the device (GPU) memory
//both src and dest arrays are already allocated on both CPU memory and GPU memory respectively. src has been also initialized.
for(int i=0; i<array_size;i++)
cudaMemcpy(&dest[i], &src[i], sizeof(float), cudaMemcpyHostToDevice);
and this is the error message I am getting at compilation time :
error: expected constructor, destructor, or type conversion before ‘(’ token
cudaMemcpy (pa, pah, N*sizeof(float *), cudaMemcpyHostToDevice);
^
Could someone please point me the source of this error? My function call of cudaMemcpy seems to be conmpliant with the signature of the function :
cudaError_t cudaMemcpy(void* dst, const void* src, size_t count, enum cudaMemcpyKind kind).
Am I missing something here please?