用OpenCL语言标准设计并实现了推荐系统领域的两种经典算法:交替最小二乘法(Alternating Least Squares,ALS)与循环坐标下降法(Cyclic Coordinate Descent,CCD)。将其应用到CPU,GPU,MIC多核与众核平台上,探索了在该平台上影响算法性能的因子:潜在特征维数与线程个数。同时,将OpenCL实现的两种算法与CUDA和OpenMP的实现进行比较,得出了一系列结论。在同等条件下,与ALS算法相比,CCD算法的精度更高,收敛速度更快且更稳定,但所耗时间更长。ALS和CCD算法基于OpenCL的实现性能不亚于CUDA(CCD上加速比为1.03x,ALS上加速比为1.2x)和OpenMP的实现(CCD与ALS上加速比大约为1.6~1.7x),并且两种算法在CPU平台上的性能均比GPU与MIC好。
In this paper,we designed and implemented two typical recommender algorithms,alternating least squares and cyclic coordinate descent in openCL.Then we evaluated them on Intel CPUs,NVIDIA GPUs and Intel MIC,and investigated the performance impacting factors:potential feature dimension and the number of thread.Meanwhile,we compared the OpenCL implementation with that of CUDA and OpenMP.Our experimental results show that in the same condition,CCD converges faster and performs more steadily,but is more time-consuming than ALS.We also observed that the performance based on OpenCL is better than CUDA and OpenMP when running on the same platform:the training time on GPU is slightly faster than that of the CUDA implementation(1.03 xfor CCD and 1.2xfor ALS),and the training time on CPU is 1.6~1.7times less than that of the OpenMP implementation with 16 threads.When running the OpenCL implementation on different platforms,we noticed that CPU performs better than both the GPU and the MIC.