cleanup cuda code