Github | 如何用Python测试GPU与CPU计算性能
点上方蓝字计算机视觉联盟获取更多干货
在右上方 ··· 设为星标 ★,与你不见不散
编辑:Sophia
计算机视觉联盟 报道 | 公众号 CVLianMeng
转载于 :https://github.com/dionhaefner/pyhpc-benchmarks
【人工智能资源(书籍+视频)全网收集,附下载!】
推荐文章【点击下面可直接跳转】:
OpenCV测量物体的尺寸技能
AI博士笔记系列推荐:
博士笔记 | 周志华《机器学习》手推笔记“神经网络”
测试代码:
$ python run.py --help
Usage: run.py [OPTIONS] BENCHMARKHPC benchmarks for PythonUsage:$ python run.py benchmarks/<BENCHMARK_FOLDER>Examples:$ taskset -c 0 python run.py benchmarks/equation_of_state$ python run.py benchmarks/equation_of_state -b numpy -b jax --gpuMore information:https://github.com/dionhaefner/pyhpc-benchmarksOptions:-s, --size INTEGER Run benchmark for this array size(repeatable) [default: 4096, 16384, 65536,262144, 1048576, 4194304]-b, --backend [numpy|bohrium|cupy|jax|theano|numba|pytorch|tensorflow]Run benchmark with this backend (repeatable)[default: run all backends]-r, --repetitions INTEGER Fixed number of iterations to run for eachsize and backend [default: auto-detect]--burnin INTEGER Number of initial iterations that aredisregarded for final statistics [default:1]--gpu / --cpu Run benchmarks on GPU where supported by thebackend [default: CPU]--help Show this message and exit.
CPU
$ taskset -c 23 python run.py benchmarks/equation_of_state/
Setup for backend "cupy" failed (skipping), reason: cupy requires GPU mode
Estimating repetitions...
Running 81642 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on CPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 jax 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.006 3.0604,096 theano 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.011 2.8344,096 numba 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.011 2.8264,096 numpy 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.006 1.0004,096 tensorflow 10,000 0.002 0.001 0.002 0.002 0.002 0.002 0.013 0.9234,096 pytorch 1,000 0.003 0.000 0.002 0.003 0.003 0.003 0.007 0.7114,096 bohrium 100 0.058 0.000 0.058 0.058 0.058 0.058 0.059 0.03216,384 jax 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.013 3.75416,384 theano 1,000 0.003 0.000 0.003 0.003 0.003 0.003 0.007 3.15016,384 numba 10,000 0.003 0.000 0.003 0.003 0.003 0.003 0.013 2.86716,384 tensorflow 1,000 0.007 0.001 0.006 0.007 0.007 0.007 0.018 1.17416,384 pytorch 1,000 0.008 0.000 0.008 0.008 0.008 0.008 0.009 1.01316,384 numpy 1,000 0.008 0.000 0.008 0.008 0.008 0.008 0.012 1.00016,384 bohrium 100 0.061 0.000 0.060 0.060 0.061 0.061 0.062 0.13765,536 jax 1,000 0.007 0.000 0.007 0.007 0.007 0.007 0.018 4.46265,536 theano 1,000 0.010 0.000 0.010 0.010 0.010 0.010 0.014 3.25965,536 numba 1,000 0.011 0.000 0.011 0.011 0.011 0.011 0.016 2.88965,536 tensorflow 1,000 0.030 0.004 0.028 0.028 0.028 0.028 0.048 1.11365,536 pytorch 100 0.031 0.001 0.031 0.031 0.031 0.031 0.036 1.06165,536 numpy 100 0.033 0.001 0.033 0.033 0.033 0.033 0.038 1.00065,536 bohrium 100 0.069 0.000 0.068 0.069 0.069 0.069 0.070 0.477262,144 jax 1,000 0.028 0.001 0.026 0.028 0.028 0.029 0.038 4.752262,144 theano 100 0.037 0.000 0.036 0.037 0.037 0.037 0.037 3.693262,144 numba 100 0.042 0.000 0.041 0.042 0.042 0.042 0.042 3.246262,144 bohrium 100 0.100 0.000 0.099 0.100 0.100 0.100 0.101 1.351262,144 pytorch 100 0.118 0.003 0.116 0.117 0.117 0.118 0.139 1.145262,144 numpy 100 0.135 0.005 0.132 0.133 0.133 0.137 0.163 1.000262,144 tensorflow 100 0.149 0.004 0.146 0.148 0.148 0.148 0.171 0.9061,048,576 jax 100 0.117 0.001 0.116 0.117 0.117 0.117 0.122 6.7521,048,576 theano 100 0.150 0.001 0.148 0.151 0.151 0.151 0.153 5.2451,048,576 numba 100 0.170 0.002 0.165 0.170 0.170 0.171 0.173 4.6411,048,576 bohrium 100 0.231 0.002 0.225 0.231 0.232 0.232 0.234 3.4181,048,576 tensorflow 10 0.684 0.003 0.681 0.682 0.682 0.686 0.689 1.1541,048,576 numpy 10 0.789 0.006 0.783 0.784 0.788 0.793 0.801 1.0001,048,576 pytorch 10 0.852 0.011 0.843 0.845 0.847 0.850 0.881 0.9274,194,304 jax 10 0.446 0.000 0.445 0.446 0.446 0.446 0.447 8.3034,194,304 theano 10 0.593 0.005 0.583 0.594 0.594 0.596 0.598 6.2444,194,304 numba 10 0.667 0.003 0.661 0.666 0.666 0.669 0.674 5.5534,194,304 bohrium 10 0.740 0.003 0.730 0.740 0.740 0.742 0.743 5.0054,194,304 tensorflow 10 3.002 0.013 2.994 2.996 2.997 2.998 3.031 1.2334,194,304 numpy 10 3.703 0.006 3.696 3.698 3.703 3.705 3.716 1.0004,194,304 pytorch 10 4.791 0.004 4.784 4.789 4.792 4.793 4.798 0.773(time in wall seconds, less is better)$ taskset -c 23 python run.py benchmarks/equation_of_state/ -s 16777216
Setup for backend "cupy" failed (skipping), reason: cupy requires GPU mode
Estimating repetitions...
Running 77 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on CPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------16,777,216 jax 10 1.864 0.007 1.857 1.860 1.861 1.867 1.880 7.79316,777,216 theano 10 2.389 0.007 2.378 2.384 2.391 2.394 2.397 6.08116,777,216 numba 10 2.681 0.010 2.667 2.676 2.679 2.683 2.707 5.41916,777,216 bohrium 10 3.191 0.016 3.153 3.184 3.193 3.203 3.208 4.55316,777,216 tensorflow 10 11.881 0.055 11.844 11.850 11.863 11.874 12.035 1.22316,777,216 numpy 10 14.527 0.074 14.454 14.481 14.500 14.530 14.678 1.00016,777,216 pytorch 10 22.358 0.124 22.152 22.278 22.363 22.447 22.577 0.650(time in wall seconds, less is better)
GPU
$ for backend in bohrium cupy jax pytorch tensorflow theano; do CUDA_VISIBLE_DEVICES="0" python run.py benchmarks/equation_of_state/ --gpu -b $backend -b numpy; done
Estimating repetitions...
Running 11832 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 numpy 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.019 1.0004,096 bohrium 100 0.059 0.001 0.058 0.059 0.059 0.059 0.069 0.03116,384 numpy 1,000 0.008 0.001 0.008 0.008 0.008 0.008 0.017 1.00016,384 bohrium 100 0.059 0.001 0.058 0.059 0.059 0.059 0.066 0.13765,536 numpy 100 0.034 0.003 0.032 0.033 0.033 0.033 0.045 1.00065,536 bohrium 100 0.059 0.003 0.058 0.059 0.059 0.059 0.088 0.564262,144 bohrium 100 0.060 0.002 0.059 0.059 0.059 0.059 0.075 2.259262,144 numpy 100 0.135 0.018 0.125 0.126 0.126 0.132 0.234 1.0001,048,576 bohrium 100 0.060 0.000 0.059 0.059 0.059 0.060 0.062 13.9841,048,576 numpy 10 0.832 0.011 0.825 0.827 0.827 0.828 0.860 1.0004,194,304 bohrium 100 0.061 0.001 0.060 0.061 0.061 0.061 0.067 60.2354,194,304 numpy 10 3.666 0.011 3.658 3.661 3.662 3.663 3.697 1.000(time in wall seconds, less is better)Estimating repetitions...
Running 16332 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 numpy 10,000 0.002 0.001 0.002 0.002 0.002 0.002 0.016 1.0004,096 cupy 1,000 0.012 0.001 0.011 0.011 0.011 0.011 0.025 0.16416,384 numpy 1,000 0.009 0.002 0.008 0.008 0.008 0.011 0.021 1.00016,384 cupy 1,000 0.012 0.001 0.011 0.011 0.011 0.011 0.024 0.80065,536 cupy 1,000 0.012 0.001 0.011 0.011 0.011 0.011 0.025 4.32165,536 numpy 100 0.050 0.002 0.041 0.049 0.051 0.052 0.055 1.000262,144 cupy 1,000 0.012 0.001 0.011 0.011 0.011 0.011 0.025 16.872262,144 numpy 100 0.196 0.003 0.193 0.194 0.195 0.196 0.214 1.0001,048,576 cupy 1,000 0.016 0.001 0.016 0.016 0.016 0.016 0.030 51.7241,048,576 numpy 10 0.851 0.003 0.847 0.848 0.850 0.853 0.857 1.0004,194,304 cupy 100 0.061 0.002 0.060 0.060 0.060 0.060 0.074 60.5244,194,304 numpy 10 3.674 0.004 3.666 3.672 3.675 3.677 3.680 1.000(time in wall seconds, less is better)Estimating repetitions...
Running 71232 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 jax 10,000 0.000 0.000 0.000 0.000 0.000 0.000 0.012 9.0634,096 numpy 10,000 0.002 0.001 0.002 0.002 0.002 0.002 0.016 1.00016,384 jax 10,000 0.000 0.000 0.000 0.000 0.000 0.000 0.014 50.35416,384 numpy 1,000 0.011 0.001 0.008 0.011 0.011 0.012 0.020 1.00065,536 jax 10,000 0.000 0.000 0.000 0.000 0.000 0.000 0.012 218.56865,536 numpy 100 0.050 0.002 0.032 0.050 0.050 0.051 0.057 1.000262,144 jax 10,000 0.000 0.000 0.000 0.000 0.000 0.000 0.012 793.155262,144 numpy 100 0.193 0.007 0.126 0.193 0.194 0.195 0.196 1.0001,048,576 jax 10,000 0.001 0.001 0.001 0.001 0.001 0.001 0.012 1036.4621,048,576 numpy 10 0.844 0.005 0.836 0.838 0.845 0.847 0.851 1.0004,194,304 jax 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.015 2811.4874,194,304 numpy 10 3.646 0.018 3.618 3.628 3.655 3.659 3.662 1.000(time in wall seconds, less is better)Estimating repetitions...
Running 431232 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 pytorch 100,000 0.000 0.000 0.000 0.000 0.000 0.000 0.017 31.6734,096 numpy 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.015 1.00016,384 pytorch 100,000 0.000 0.000 0.000 0.000 0.000 0.000 0.015 132.56116,384 numpy 1,000 0.008 0.000 0.008 0.008 0.008 0.008 0.011 1.00065,536 pytorch 100,000 0.000 0.000 0.000 0.000 0.000 0.000 0.015 457.42565,536 numpy 100 0.040 0.006 0.032 0.032 0.044 0.045 0.050 1.000262,144 pytorch 100,000 0.000 0.000 0.000 0.000 0.000 0.000 0.018 1036.713262,144 numpy 100 0.186 0.006 0.175 0.179 0.185 0.191 0.198 1.0001,048,576 pytorch 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.015 1376.5811,048,576 numpy 10 0.798 0.004 0.791 0.796 0.797 0.800 0.804 1.0004,194,304 pytorch 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.013 1854.1394,194,304 numpy 10 3.695 0.001 3.693 3.694 3.694 3.696 3.697 1.000(time in wall seconds, less is better)Estimating repetitions...
Running 16332 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 numpy 10,000 0.002 0.001 0.002 0.002 0.002 0.002 0.014 1.0004,096 tensorflow 1,000 0.006 0.007 0.003 0.004 0.004 0.005 0.056 0.32416,384 tensorflow 1,000 0.006 0.007 0.003 0.004 0.004 0.005 0.055 1.43616,384 numpy 1,000 0.009 0.001 0.007 0.008 0.008 0.008 0.020 1.00065,536 tensorflow 1,000 0.006 0.007 0.003 0.004 0.004 0.005 0.054 6.19565,536 numpy 100 0.039 0.004 0.033 0.036 0.037 0.043 0.053 1.000262,144 tensorflow 1,000 0.006 0.005 0.003 0.005 0.005 0.005 0.049 33.489262,144 numpy 100 0.188 0.003 0.184 0.185 0.187 0.190 0.195 1.0001,048,576 tensorflow 1,000 0.008 0.003 0.005 0.008 0.008 0.008 0.032 99.6341,048,576 numpy 10 0.827 0.001 0.825 0.826 0.827 0.828 0.829 1.0004,194,304 tensorflow 100 0.017 0.001 0.013 0.017 0.017 0.017 0.020 214.0694,194,304 numpy 10 3.682 0.003 3.678 3.679 3.682 3.685 3.687 1.000(time in wall seconds, less is better)Estimating repetitions...
Running 52332 benchmarks... [####################################] 100%benchmarks.equation_of_state
============================
Running on GPUsize backend calls mean stdev min 25% median 75% max Δ
------------------------------------------------------------------------------------------------------------------4,096 theano 10,000 0.000 0.001 0.000 0.000 0.000 0.000 0.012 7.4044,096 numpy 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.013 1.00016,384 theano 10,000 0.000 0.000 0.000 0.000 0.000 0.000 0.012 23.92316,384 numpy 1,000 0.008 0.001 0.008 0.008 0.008 0.008 0.020 1.00065,536 theano 10,000 0.001 0.000 0.001 0.001 0.001 0.001 0.012 66.85865,536 numpy 100 0.042 0.002 0.033 0.041 0.042 0.045 0.046 1.000262,144 theano 10,000 0.002 0.000 0.002 0.002 0.002 0.002 0.013 118.739262,144 numpy 100 0.196 0.002 0.192 0.195 0.196 0.198 0.208 1.0001,048,576 theano 1,000 0.008 0.001 0.006 0.006 0.008 0.009 0.009 114.6211,048,576 numpy 10 0.860 0.001 0.858 0.859 0.860 0.861 0.863 1.0004,194,304 theano 100 0.032 0.000 0.032 0.032 0.032 0.032 0.033 115.1814,194,304 numpy 10 3.737 0.003 3.735 3.735 3.736 3.737 3.745 1.000(time in wall seconds, less is better)
END
声明:本文来源于网络
如有侵权,联系删除
联盟学术交流群
扫码添加联盟小编,可与相关学者研究人员共同交流学习:目前开设有人工智能、机器学习、计算机视觉、自动驾驶(含SLAM)、Python、求职面经、综合交流群扫描添加CV联盟微信拉你进群,备注:CV联盟
最新热文荐读
GitHub | 计算机视觉最全资料集锦(含实验室、算法及AI会议)
Github | 标星1W+清华大学计算机系课程攻略!
Github | 吴恩达新书《Machine Learning Yearning》完整中文版开源
收藏 | 2020年AI、CV、NLP顶会最全时间表!
收藏 | 博士大佬总结的Pycharm 常用快捷键思维导图!
笔记 | 深度学习综述思维导图(可下载)
笔记 | 深度神经网络综述思维导图(可下载)
内推 | 4399小游戏
内推 | 无人驾驶~小马智行Pony.ai 2020
内推 | 虎牙直播2020校招
内推 | 字节跳动内推
前沿 | 阿里达摩院发布2019十大科技趋势!未来无限可期!
点个在看支持一下吧
Github | 如何用Python测试GPU与CPU计算性能相关推荐
- python 输出 GPU内存 最大使用率
安装 pip install nvidia-ml-py from pynvml import * def nvidia_info():# pip install nvidia-ml-pynvidia_ ...
- 如何用Python一门语言通吃高性能并发、GPU计算和深度学习
[CTO讲堂]如何用Python一门语言通吃高性能并发.GPU计算和深度学习 发表于2016-01-04 15:11| 4374次阅读| 来源CSDN| 4 条评论| 作者蒲婧 CTO俱乐部CTOCT ...
- python测试代码运行时间_10种检测Python程序运行时间、CPU和内存占用的方法
在运行复杂的Python程序时,执行时间会很长,这时也许想提高程序的执行效率.但该怎么做呢? 首先,要有个工具能够检测代码中的瓶颈,例如,找到哪一部分执行时间比较长.接着,就针对这一部分进行优化. 同 ...
- python rest api 测试_如何用Python编写REST API的单元测试
在过去的几个月中,正在从事一个名为B的项目.它是带有简单Web UI的徽章生成器,用于添加数据并生成PDF可打印徽章.B后端现在已转移到REST-API并测试REST-API中使用的功能,我们需要一些 ...
- python 死循环程序能占满cpu吗_运行tensorflow python程序,限制对GPU和CPU的占用操作...
一般情况下,运行tensorflow时,默认会占用可以看见的所有GPU,那么就会导致其它用户或程序无GPU可用,那么就需要限制程序对GPU的占用.并且,一般我们的程序也用不了所有的GPU资源,只是强行 ...
- 热榜第一!GitHub 标星 5.6w,如何用 Python 实现所有算法?
转自 | 大数据文摘 编译 | 周素云.蒋宝尚 学会了 Python 基础知识,想进阶一下,那就来点算法吧!毕竟编程语言只是工具,结构算法才是灵魂. 新手如何入门 Python 算法? 几位印度小哥在 ...
- Github标星2w+,热榜第一,如何用Python实现所有算法
大数据文摘出品 编译:周素云.蒋宝尚 学会了Python基础知识,想进阶一下,那就来点算法吧!毕竟编程语言只是工具,结构算法才是灵魂. 新手如何入门Python算法? 几位印度小哥在GitHub上建了 ...
- python 测试字符串类型_【教程】如何用Python中的chardet去检测字符编码类型
[背景] 之前已经使用过chardet了,也算用了不少次了. 之前也写过和chardet相关的: 但是没写教程,举例说明如何使用. 现在去举例解释解释. [python示例代码演示如何用chardet ...
- Github标星3w+,热榜第一,如何用Python实现所有算法
点击"小詹学Python",选择"星标"公众号 重磅干货,第一时间送达 大数据文摘出品 编译:周素云.蒋宝尚 学会了Python基础知识,想进阶一下,那就来点算 ...
最新文章
- 一个简单的例子学会github repository的webhook
- 人工智能如何落地安防?需先迈过算力这一关
- 错误 error C2220: 警告被视为错误 - 没有生成“object”文件
- 电脑功耗监测_应急监测便携式VOC检测仪色谱分析仪原理解析
- 【转】30个你不可不知的CSS选择器
- SCI和影响因子:学术评估与商业运作——Nature实证研究
- win32 disk imager使用后u盘容量恢复
- shell错位_shell脚本出错!来大神指出错误出处!!!!
- java毕业设计鉴赏_高校科研管理系统
- phpcms移动端和pc端_phpcms 实现PC端、手机端的双模版
- python中xlsxwriter模块_python xlsxwriter模块的使用
- lwj_C#_周总结1
- win7无法自动获取dns服务器地址,Win7无法自动获取DNS与IP地址怎么办
- 2-折腾python:继续一些瞎打印的小把戏
- django celer_Celer招募Zing作为下一代基于Java的交易平台
- linux系统fasta程序,fasta格式文件处理大全(一)
- 在线工具:电脑怎么提取图片中的文字?图片如何转化为文字?
- zabbix调用sendsms.py脚本,发送短信
- java一元二次方程求解_求JAVA解一元二次方程的程序。
- (20191231)免费下载论文的方法汇总