WIN11 + CUDA11.7配置深度学习开发环境(一)

#视频截取的模型
训练开发的视频截取器,公司给发的电脑,在这里记录一下环境配置的过程,由于已经安装了cuda等环境(我也不想重新下载啦),就利用11.7做这个练习。以后遇到问题在解决。
首先给出参考经验帖。[这个电脑是RTX3060+win11]
(https://blog.csdn.net/x242510/article/details/123069195)
##检查cuda是否安装成功的方法:
###1.使用shell命令行(nvidia-smi)

Thu Dec 15 14:25:46 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 517.48       Driver Version: 517.48       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P3    17W /  N/A |      0MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

###方法二:找到Nvidia control Panel
WIN11 + CUDA11.7配置深度学习开发环境(一)_第1张图片
WIN11 + CUDA11.7配置深度学习开发环境(一)_第2张图片
##2. 运行时API(Runtime API)
命令行输入nvcc -V

也可以参考这篇文章cuda基础。
#安装过程
参考这两篇文章(Win11和Win11 + RTX3060 配置Cuda等深度学习环境),先按照别人的经验走一遍,在最后搞自己的版本,就像大一开始装电脑一样,没接触的东西多尝试几次。
##环境变量配置

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\lib

环境检查

cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7

cd extras\demo_suite

.\bandwidthTest.exe

WIN11 + CUDA11.7配置深度学习开发环境(一)_第3张图片
##下载相对应的python包,不想出问题的话,按照一步步来。我在测试学习3.9的环境,一起学习吧。

>>> import tensorflow as tf
>>> tf.reduce_sum(tf.random.normal([1000, 1000])

结果是这个东西

WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2022-12-16 08:54:52.073841: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-16 08:54:55.279269: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /device:GPU:0 with 1666 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3050 Laptop GPU, pci bus id: 0000:01:00.0, compute capability: 8.6

这个显示一下GPU,这里还没有搞懂怎么回事(需要搞清楚)

>>> tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
>>> version = tf.version
>>> gpu_ok = tf.test.is_gpu_available()

打印自己的GPU,这样应该没问题啦

>>> print("tf version:",version,"\nuse GPU",gpu_ok)
tf version: <module 'tensorflow._api.v2.version' from 'C:\\Program Files\\Anaconda\\lib\\site-packages\\tensorflow\\_api\\v2\\version\\__init__.py'>
use GPU True

你可能感兴趣的:(python自学,深度学习,linux,python,scikit-learn,pandas)