Release device resources, add timers, and tidy up opencl code