CUDA implementation