added 3D CUDA code (bugs)