這篇文章主要介紹了大數(shù)據(jù)中常用框架的測試方法有哪些,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)公司提供高防物理服務(wù)器租用、云服務(wù)器、香港服務(wù)器、中國電信成都樞紐中心等
TensorFlow1.x與TensorFlow2.x測試方法是一樣的,代碼如下:
import tensorflow as tf print(tf.test.is_gpu_available())
上述代碼保存為.py文件,使用需要測試環(huán)境即可運(yùn)行,輸出:上面是一下log信息,關(guān)鍵的是的最后True,表示測試成功
2020-09-28 15:43:03.197710: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2020-09-28 15:43:03.204525: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2020-09-28 15:43:03.232432: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: name: GeForce RTX 2070 with Max-Q Design major: 7 minor: 5 memoryClockRate(GHz): 1.125 pciBusID: 0000:01:00.0 2020-09-28 15:43:03.235352: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll 2020-09-28 15:43:03.242823: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll 2020-09-28 15:43:03.261932: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll 2020-09-28 15:43:03.268757: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll 2020-09-28 15:43:03.297478: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll 2020-09-28 15:43:03.315410: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll 2020-09-28 15:43:03.330562: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll 2020-09-28 15:43:03.332846: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0 2020-09-28 15:43:05.198465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-09-28 15:43:05.200423: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0 2020-09-28 15:43:05.201540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N 2020-09-28 15:43:05.203863: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 6306 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2070 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 7.5) True
上面是一下log信息,關(guān)鍵的是的最后True,表示測試成功。其實(shí)我們還可以發(fā)現(xiàn)很多GPU信息
GPU型號(hào):name: GeForce RTX 2070 with Max-Q Design
cuda版本:Successfully opened dynamic library cudart64_100.dll(10.0)
cudnn版本:Successfully opened dynamic library cudnn64_7.dll(7.x)
GPU數(shù)目:Adding visible gpu devices: 0(1)
GPU顯存:/device:GPU:0 with 6306 MB memory(8G)
PyTorch與TensorFlow測試方法類似,都有GPU測試接口。PyTorch的GPU測試代碼如下:
import torch print(torch.cuda.is_available())
上述代碼保存為.py文件,使用需要測試環(huán)境即可運(yùn)行,輸出:True,表示測試成功
True
可以看出PyTorch輸出信息簡潔很多。其實(shí)TensorFlow的log信息輸出也是可以控制的。
MXNet與PyTorch,TensorFlow測試方法不同,由于MXNet'沒有GPU測試接口(或者說筆者沒有找到)。所以MXNet的GPU測試代碼采用try-catch捕捉異常的方法來測試,代碼如下:
import mxnet as mx mxgpu_ok = False try: _ = mx.nd.array(1,ctx=mx.gpu(0)) mxgpu_ok = True except: mxgpu_ok = False print(mxgpu_ok)
上述代碼保存為.py文件,使用需要測試環(huán)境即可運(yùn)行,輸出:True,表示測試成功
PaddlePaddle與TensorFlow測試方法類似,都有GPU測試接口。PyTorch的GPU測試代碼如下:
import paddle paddle.fluid.install_check.run_check()
上述代碼保存為.py文件,使用需要測試環(huán)境即可運(yùn)行,輸出:Your Paddle Fluid works well on MUTIPLE GPU or CPU.,表示測試成功
Running Verify Fluid Program ... W0928 16:23:17.825171 10572 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 75, Driver API Version: 11.0, Runtime API Version: 10.0 W0928 16:23:17.836141 10572 device_context.cc:260] device: 0, cuDNN Version: 7.6. Your Paddle Fluid works well on SINGLE GPU or CPU. W0928 16:23:19.349067 10572 build_strategy.cc:170] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. Your Paddle Fluid works well on MUTIPLE GPU or CPU. Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“大數(shù)據(jù)中常用框架的測試方法有哪些”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
網(wǎng)站題目:大數(shù)據(jù)中常用框架的測試方法有哪些
URL分享:http://jinyejixie.com/article30/gcspso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、手機(jī)網(wǎng)站建設(shè)、ChatGPT、Google、企業(yè)網(wǎng)站制作、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)