Optimize CUDA programs