I looked at some other posts about this on stackoverflow, but nothing really helps. I installed only the tensorflow-gpu version and installed keras.
I checked that gpu was recognized, namely:
print(device_lib.list_local_devices())
print('Tensorflow: ', tf.__version__)
of
[name: "/cpu:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 17474054933763055451
, name: "/gpu:0"
device_type: "GPU"
memory_limit: 52848230
locality {
bus_id: 1
}
incarnation: 1990869997540085603
physical_device_desc: "device: 0, name: GeForce GTX 1070, pci bus id:
0000:01:00.0"
]
Tensorflow: 1.3.0
But when I run the keras model using endorflow-back-end, it does not seem to be faster than when I run it on another computer using the tensorflow-cpu method without nvidia. Also looking at the task manager, I see a surge in CPU usage. I am new to this and trying to figure it all out, but shouldn't it work with the model / trace much faster? And shouldn't I see an increase in CPU usage if it uses GPUs?
- , . tensorflow-gpu, CUDA, cudnn ..
:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 387.92 Driver Version: 387.92 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce GTX 1070 WDDM | 00000000:01:00.0 On | N/A |
| N/A 49C P8 9W / N/A | 7028MiB / 8192MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 3740 C C:\Users\Jason\Anaconda3\pythonw.exe N/A |
| 0 3968 C+G ...dows.Cortana_cw5n1h2txyewy\SearchUI.exe N/A |
| 0 4392 C+G C:\Windows\explorer.exe N/A |
| 0 7760 C+G ...0.0_x64__8wekyb3d8bbwe\WinStore.App.exe N/A |
| 0 8976 C+G ...6)\Google\Chrome\Application\chrome.exe N/A |
| 0 9932 C+G ...rosoft Office\root\Office16\WINWORD.EXE N/A |
| 0 12632 C+G Insufficient Permissions N/A |
| 0 14168 C+G Insufficient Permissions N/A |
| 0 14548 C+G ...t_cw5n1h2txyewy\ShellExperienceHost.exe N/A |
| 0 15648 C+G Insufficient Permissions N/A |
+-----------------------------------------------------------------------------+
:
C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi
Fri Oct 13 13:18:23 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 387.92 Driver Version: 387.92 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce GTX 1070 WDDM | 00000000:01:00.0 On | N/A |
| N/A 51C P2 34W / N/A | 7126MiB / 8192MiB | 15% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 3740 C C:\Users\Jason\Anaconda3\pythonw.exe N/A |
| 0 3968 C+G ...dows.Cortana_cw5n1h2txyewy\SearchUI.exe N/A |
| 0 4392 C+G C:\Windows\explorer.exe N/A |
| 0 7760 C+G ...0.0_x64__8wekyb3d8bbwe\WinStore.App.exe N/A |
| 0 8976 C+G ...6)\Google\Chrome\Application\chrome.exe N/A |
| 0 9932 C+G ...rosoft Office\root\Office16\WINWORD.EXE N/A |
| 0 12632 C+G Insufficient Permissions N/A |
| 0 14168 C+G Insufficient Permissions N/A |
| 0 14548 C+G ...t_cw5n1h2txyewy\ShellExperienceHost.exe N/A |
| 0 15648 C+G Insufficient Permissions N/A |
+-----------------------------------------------------------------------------+
Anaconda Python 3.6;
Tensorflow-gpu 1.3
- Visual Studio 15 ( CUDA 8 17,
VS 15)
- CUDA v8.0: PATH
- Nvidia
- cudnn-v6.0 CUDA 8
5.1. Tensorflow 1.3 Cudnn-v6.0: PATH
UPDATE:
, . . Keras.
import numpy as np
from keras import models
from keras import layers
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import GridSearchCV
import datetime
np.random.seed(7)
def create_network(optimizer='adam',activation='relu'):
network = models.Sequential()
network.add(layers.Dense(units=dim, activation=activation, input_shape=(dim,)))
network.add(layers.Dense(units=20, activation=activation))
network.add(layers.Dense(units=1, activation='linear'))
network.compile(loss='mse',
optimizer=optimizer,
metrics=['mae'])
return network
neural_network = KerasRegressor(build_fn=create_network, verbose=2)
epochs = [5, 50, 100, 150]
batches = [1, 5, 10, 100]
hyperparameters = dict(epochs=epochs, batch_size=batches)
start_time = datetime.datetime.now()
grid = GridSearchCV(estimator=neural_network, param_grid=hyperparameters)
grid_result = grid.fit(X, Y)
grid_result.best_params_
print("Best: %f using %s" % (grid_result.best_score_,
grid_result.best_params_))
means = grid_result.cv_results_['mean_test_score']
stds = grid_result.cv_results_['std_test_score']
params = grid_result.cv_results_['params']
for mean, stdev, param in zip(means, stds, params):
print("%f (%f) with: %r" % (mean, stdev, param))
end_time = datetime.datetime.now()
processing_time = end_time - start_time
print(str(processing_time).split('.')[0])
2:
, , -... , ... - , ?
scikit GridSearchCV. keras tensorflow, scikit-learn , ? , keras, , ?