動作環境
Docker環境 (https://github.com/FunabikiKeisuke/dnn-watermark/tree/ea01cc9fb888c95ae4ab58b73180a636ceeeba79/docker)
# echo $CUDA_VERSION
8.0.61
# echo $CUDNN_VERSION
5.1.10
# nvidia-smi
Fri Apr 15 01:39:15 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.103.01 Driver Version: 470.103.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA RTX A6000 Off | 00000000:01:00.0 On | Off |
| 30% 41C P8 30W / 300W | 574MiB / 48677MiB | 13% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
GPUは認識されている.
tensorflowのGPU判定
# python3
Python 3.5.2 (default, Jan 26 2021, 13:30:48)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.test.is_gpu_available()
False
GPUがTFに認識されていない.
やったこと
DockerHubの tensorflow/tensorflow:0.12.1-gpu-py3 の環境 (https://github.com/FunabikiKeisuke/dnn-watermark/tree/ea01cc9fb888c95ae4ab58b73180a636ceeeba79/dockerhub) ではGPUが認識される.
# python
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
>>> tf.test.is_gpu_available()
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:937] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties:
name: NVIDIA RTX A6000
major: 8 minor: 6 memoryClockRate (GHz) 1.8
pciBusID 0000:01:00.0
Total memory: 47.54GiB
Free memory: 46.70GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: NVIDIA RTX A6000, pci bus id: 0000:01:00.0)
True
しかし,コードを動作させるのに必要な keras==1.1.2
の依存ライブラリである PyYAML
が python3.4 だと入らない.
# pip install keras==1.1.2
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Collecting keras==1.1.2
Downloading https://files.pythonhosted.org/packages/69/69/23d1c7e70a5e548a72d7fd73766d7d3cb6a7d46a0ef15467990c2a6594c9/Keras-1.1.2.tar.gz (160kB)
|################################| 163kB 998kB/s
Collecting theano (from keras==1.1.2)
Downloading https://files.pythonhosted.org/packages/6b/97/bcd5654ba60f35f180931afabbd3b4c46c0379852f961c7a2819ff897f5d/Theano-1.0.5.tar.gz (2.8MB)
|################################| 2.8MB 7.2MB/s
Collecting pyyaml (from keras==1.1.2)
Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
|################################| 276kB 44.4MB/s
ERROR: PyYAML requires Python '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*' but the running Python is 3.4.3