opencl: code cleanup and CL_DEVICE_TYPE env var for unit tests