Research Article
OpenCL Performance Evaluation on Modern Multicore CPUs
Algorithm 1
Vectorization on OpenCL versus OpenMP. The equivalent code in OpenCL is vectorizable while OpenMP code is not vectorizable.
/*OpenMP computation that doesn’t vectorize due to dependencies.*/ | int main(){ | | for (int ; ; ++){ | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | } | | | /*Similar OpenCL kernel computation which vectorizes.*/ | void VectorAdd (…, _ _global float *dm_src, _ _global float *dm_dst){ | | for (int ; ; ++){ | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | FMUL(_, _) | } | | |
|