This version works with CUDA