
受此贴启发,除鲲鹏 920 外的数据也来自此贴: https://v2ex.com/t/733777
成绩对比选的是基于 Numpy 的数值计算( Neon SIMD 加速),测试脚本为:
https://gist.github.com/markus-beuckelmann/8bc25531b11158431a5b09a45abd6276
废话不多说,上成绩:
| 项目 | M1 | 鲲鹏 920-12 核 | 鲲鹏 920-24 核 | Core i9 |
|---|---|---|---|---|
| 4096x4096 矩阵乘法 | 0.53 s | 1.48 s | 0.76 s | 0.45 s |
| 524288 向量点积 | 0.25 ms | 0.49 ms | 0.48 ms | 0.05 ms |
| 2048x1024 SVD | 0.59 s | 1.10 s | 0.93 s | 0.32 s |
| 2048x2048 Cholesky 分解 | 0.08 s | 0.14 s | 0.13 s | 0.08 s |
| 2048x2048 特征分解 | 4.74 s | 8.36 s | 7.66 s | 3.53 s |
结论:
由于是调用的底层加速库,Numpy 在数值计算方面可以有效使用多核进行运算。大体上看,哪怕是 24 核鲲鹏 920 的数值计算性能也比 M1 慢一半左右,向量乘法和 SVD 几乎慢一倍。
Core i9 是原帖网友 @pb941129 基于 16 寸 MBP i9 所得,由于数值计算是英特尔的传统强项,外加在 MKL 底层的加持下,各项方面性能均领先 M1 (原帖网友 @YUX 所测).
备注:
1 鲲鹏 920 是在华为云上测试的。
2 除 Core i9 外,Numpy 安装统一用的是 Miniforge,加速库配置为:
blas_info: libraries = ['cblas', 'blas', 'cblas', 'blas'] library_dirs = ['/root/miniforge3/lib'] include_dirs = ['/root/miniforge3/include'] language = c define_macros = [('HAVE_CBLAS', None)] blas_opt_info: define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)] libraries = ['cblas', 'blas', 'cblas', 'blas'] library_dirs = ['/root/miniforge3/lib'] include_dirs = ['/root/miniforge3/include'] language = c lapack_info: libraries = ['lapack', 'blas', 'lapack', 'blas'] library_dirs = ['/root/miniforge3/lib'] language = f77 lapack_opt_info: libraries = ['lapack', 'blas', 'lapack', 'blas', 'cblas', 'blas', 'cblas', 'blas'] library_dirs = ['/root/miniforge3/lib'] language = c define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)] include_dirs = ['/root/miniforge3/include'] 1 felixcode 2021 年 4 月 23 日 华为云上用的是独服吗? i9 达到功耗墙和温度墙了没有? |
3 FurN1 2021 年 4 月 23 日 via iPhone 赞 |
4 0987363 2021 年 4 月 23 日 多核参考意义不大啊,有没有单核成绩 |
6 0987363 2021 年 4 月 23 日 Dotted two 4096x4096 matrices in 0.35 s. Dotted two vectors of length 524288 in 0.03 ms. SVD of a 2048x1024 matrix in 0.30 s. Cholesky decomposition of a 2048x2048 matrix in 0.05 s. Eigendecomposition of a 2048x2048 matrix in 3.05 s. 黑果 10850k 跑了下 最高只能用到 10 线程 |
7 YRInc OP @0987363 嗯嗯,取决于加速库的配置,默认情况下(具体为啥我也不知),最大线程数限制在物理核心数上,不使用超线程。这也是 Matlab 和 Mathmatica 所采用的策略。 |
8 0987363 2021 年 4 月 23 日 @YRInc 在 debian 上,能用上超线程,2630l v4 Dotted two 4096x4096 matrices in 0.91 s. Dotted two vectors of length 524288 in 0.05 ms. SVD of a 2048x1024 matrix in 0.90 s. Cholesky decomposition of a 2048x2048 matrix in 0.18 s. Eigendecomposition of a 2048x2048 matrix in 12.48 s. |
11 Deepseafish 2021 年 4 月 23 日 非空载跑的,前两项波动比较大 E5-2680 v4 Dotted two 4096x4096 matrices in 0.33 s. Dotted two vectors of length 524288 in 0.03 ms. SVD of a 2048x1024 matrix in 0.34 s. Cholesky decomposition of a 2048x2048 matrix in 0.10 s. Eigendecomposition of a 2048x2048 matrix in 3.82 s. Xeon(R) Platinum 8170 Dotted two 4096x4096 matrices in 0.77 s. Dotted two vectors of length 524288 in 0.13 ms. SVD of a 2048x1024 matrix in 0.48 s. Cholesky decomposition of a 2048x2048 matrix in 0.30 s. Eigendecomposition of a 2048x2048 matrix in 5.94 s. E5-2690 v4 Dotted two 4096x4096 matrices in 0.93 s. Dotted two vectors of length 524288 in 0.14 ms. SVD of a 2048x1024 matrix in 1.60 s. Cholesky decomposition of a 2048x2048 matrix in 0.13 s. Eigendecomposition of a 2048x2048 matrix in 6.90 s. |
12 华为云上的。。 性能打折扣了。 |
13 secondwtq 2021 年 4 月 23 日 via iPhone 就鲲鹏 12 核和 24 核的结果对比来看,貌似除了矩阵乘之外的算法并不能”有效”利用多核啊 |
14 alphatoad 2021 年 4 月 23 日 i9 还是很强,是用了 AVX 吗 不过考虑到 M1 只是个低功耗试水产品很看到后续产品线 |
17 jr55475f112iz2tu 2021 年 4 月 23 日 via Android 鲲鹏是服务器 U M1 是消费级 U 不知道有什么好比的 |
19 dayeye2006199 2021 年 4 月 24 日 arm 的数值计算有什么技术进展吗?指令集带来的差异,下层的库能拉平性能差异么?求科普 |
20 YRInc OP @dayeye2006199 只知道下一代 Arm v9 更新了 SIMD 指令集,SVE2 。以后的数值计算能力也会越来越强吧 |
21 dabaibai 2021 年 4 月 24 日 华为云上用的是独服吗?如果是云主机的话 毫无参考价值 |
22 datou 2021 年 4 月 25 日 Dotted two 4096x4096 matrices in 0.67 s. Dotted two vectors of length 524288 in 0.05 ms. SVD of a 2048x1024 matrix in 0.96 s. Cholesky decomposition of a 2048x2048 matrix in 0.28 s. Eigendecomposition of a 2048x2048 matrix in 6.69 s. 3500X win10 |
23 neosfung 2021 年 4 月 25 日 拿了 2019 年 16 寸 MacBook 和服务器分别测了一下,供参考 Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz * 2 Dotted two 4096x4096 matrices in 1.45 s. Dotted two vectors of length 524288 in 0.17 ms. SVD of a 2048x1024 matrix in 0.90 s. Cholesky decomposition of a 2048x2048 matrix in 0.20 s. Eigendecomposition of a 2048x2048 matrix in 8.83 s. Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Dotted two 4096x4096 matrices in 0.73 s. Dotted two vectors of length 524288 in 0.08 ms. SVD of a 2048x1024 matrix in 0.52 s. Cholesky decomposition of a 2048x2048 matrix in 0.09 s. Eigendecomposition of a 2048x2048 matrix in 4.89 s. |