some work on cuda implementation