prepare/modify some functions for OpenCL implementation