Matrix multiplication is fundamental in the backpropagation algorithm used to train deep neural network models. Libraries like Intel's MKL or NVIDIA's cuBLAS implemented new and optimized matrix multiplication techniques that increase performance and reduce computational costs. These techniques can also be implemented in CUDA and SYCL and functions with AVX2 and AVX512 instructions, which have lower performance but better precision. The study compares execution times and power consumption using PAPI and PERF and compares accuracy for different matrix sizes. Comparisons were made on architectures such as third and fourth-generation Intel CPUs and NVIDIA V100 and A100 GPUs. The MKL library showed the best performance with a slight loss of precision, while OpenMP and SYCL on the CPU implementation showed the best accuracy but a loss of performance. On the other hand, the results on GPU showed that cuBLAS with tensor cores had the best performance; however, it had a cost in accuracy. The cuBLAS library without these specialized cores shows minimal performance loss and much higher accuracy. The data obtained on different architectures showed that the CPU could achieve performance close to that obtained on the GPU with increased power consumption. These results are conditional on certain hardware specifications, such as the number of cores, clock frequency, processor generation for the CPU, and the speed and bandwidth of the PCI bus and device architecture (compute capability) for the GPU.
翻译:矩阵乘法是训练深度神经网络模型所用反向传播算法的核心运算基础。英特尔MKL与英伟达cuBLAS等库实现了新型优化矩阵乘法技术,在提升性能的同时降低了计算成本。这些技术亦可通过CUDA和SYCL配合AVX2、AVX512指令集实现,虽性能较低但具有更优精度。本研究采用PAPI与PERF工具对比不同矩阵规模下的执行时间、功耗及计算精度,并在第三代/第四代英特尔CPU与英伟达V100、A100 GPU等架构上进行测试。结果显示:MKL库在CPU上表现出最佳性能但伴随轻微精度损失;基于CPU的OpenMP与SYCL实现精度最优但存在性能损耗。在GPU方面,启用张量核心的cuBLAS性能最优但精度代价显著;未启用专用核心的cuBLAS库则呈现极小的性能损失与显著更高的精度。跨架构数据表明:CPU在功耗增加条件下可达到接近GPU的性能水平。这些结果受特定硬件规格制约,包括CPU的核心数、时钟频率、处理器代际,以及GPU的PCI总线速率带宽与设备架构(计算能力)。