Aktionen

GPU-Erweiterung für Ubuntu: Unterschied zwischen den Versionen

Aus exmediawiki

 
Zeile 93: Zeile 93:
 
[[Category:Keras]]
 
[[Category:Keras]]
 
[[Category:GPU]]
 
[[Category:GPU]]
 +
[[Category:Command Line]]

Aktuelle Version vom 29. April 2019, 22:53 Uhr


auf einem System auf dem noch nicht Anaconda etc. vorinstalliert ist.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3-pip python3-dev


sudo apt-get install build-essential cmake git
sudo apt-get install libopenblas-dev 
sudo apt-get install liblapack-dev
sudo apt-get install python-numpy python-scipy python-matplotlib
sudo apt-get install libhdf5-serial-dev python-h5py
sudo apt-get install graphviz
sudo pip3 install pydot-ng
sudo apt-get install python-opencv

CUDA downloaden:

https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu


CUDA-Version für 17.04 auswählen (funktioniert auch für Ubuntu 18.04)

sudo dpkg -i cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64.deb
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
cuda dir: /usr/local/cuda-9.0
cuDNN >= 7.2
https://developer.nvidia.com/cudnn
sudo dpkg -i libcudnn7_7.4.1.5-1+cuda9.0_amd64.deb
sudo pip3 install tensorflow-gpu

verify:

python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

output sollte so ähnlich aussehen:

2018-12-11 17:19:43.988326: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this 
TensorFlow binary was not compiled to use: AVX2 FMA
2018-12-11 17:19:44.075230: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had 
negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-12-11 17:19:44.075916: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties: 
name: GeForce GTX 960M major: 5 minor: 0 memoryClockRate(GHz): 1.176
pciBusID: 0000:01:00.0
totalMemory: 1.96GiB freeMemory: 1.72GiB
2018-12-11 17:19:44.075953: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2018-12-11 17:22:28.528023: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with 
strength 1 edge matrix:
2018-12-11 17:22:28.528065: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0 
2018-12-11 17:22:28.528072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N 
2018-12-11 17:22:28.528250: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device 
(/job:localhost/replica:0/task:0/device:GPU:0 with 1477 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960M, pci bus 
id: 0000:01:00.0, compute capability: 5.0)
tf.Tensor(-253.9591, shape=(), dtype=float32)

danach keras und jupyter installieren:

sudo pip3 install keras
sudo python3 -m pip install jupyter