I am wondering how to properly copy value of host variable directly to device variable
I tried to use cudaMemcpy but without any special results. I was getting only garbage or nothing.
Pixel_GPU* Device_Array{};
//__device__ size_t size{};
size_t size{};
cudaMalloc((void**)& Device_Array, global_size * sizeof(Pixel_GPU));
cudaMalloc((void**) size, sizeof(size_t));
cudaMemset(&size, 0, sizeof(size_t));
cudaMemcpy(Device_Array, Host_Array, global_size * sizeof(Pixel_GPU), HostToDevice);
cudaMemcpy(&size, &global_size, sizeof(size_t), HostToDevice);
_STD cout << global_size << NEW_LINE;
Show_Device_Variables <<<2, 1>>>(&size);
cudaFree(&size);
cudaFree(Device_Array);
free(Host_Array);
For instance: global_size may have size upon to 1 000 000 . Size_t is able to take it on, but the size of "size" (device array size) is still uninitialized
cudaMallocat all. You might want to study a basic CUDA sample code likevectorAdd.