102
102
103
103
"""
104
104
Testing function to check whether your computations have been made on CPU or GPU.
105
- If the result is 'Used the cpu' and you want to have it in gpu, do the following:
105
+ If the result is 'Used the cpu' and you want to have it in gpu, do the following:
106
106
1) install theano:
107
107
sudo python3.5 -m pip install Theano
108
108
2) download and install the latest cuda:
111
111
http://askubuntu.com/questions/760242/how-can-i-force-16-04-to-add-a-repository-even-if-it-isnt-considered-secure-eno
112
112
You may also want to grab the proper NVidia driver, choose it form there:
113
113
System Settings > Software & Updates > Additional Drivers.
114
- 3)
114
+ 3) should work, run it with:
115
+ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python3.5 test.py
116
+ http://deeplearning.net/software/theano/tutorial/using_gpu.html
117
+ 4) Optionally, you can add cuDNN support from:
118
+ https://developer.nvidia.com/cudnn
119
+
115
120
116
121
"""
117
122
@@ -120,7 +125,7 @@ def testTheano():
120
125
import theano .tensor as T
121
126
import numpy
122
127
import time
123
-
128
+ print ( "Testing Theano library..." )
124
129
vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
125
130
iters = 1000
126
131
@@ -140,17 +145,19 @@ def testTheano():
140
145
print ('Used the gpu' )
141
146
142
147
# Perform check:
143
- # testTheano()
148
+ testTheano ()
144
149
145
150
146
151
# ----------------------
147
152
# - network3.py example:
148
153
import network3
149
154
155
+ '''
150
156
from network3 import ConvPoolLayer, FullyConnectedLayer, SoftmaxLayer
151
157
training_data, validation_data, test_data = network3.load_data_shared()
152
158
mini_batch_size = 10
153
159
net = network3.Network([
154
160
FullyConnectedLayer(n_in=784, n_out=100),
155
161
SoftmaxLayer(n_in=100, n_out=10)], mini_batch_size)
156
162
net.SGD(training_data, 60, mini_batch_size, 0.1, validation_data, test_data)
163
+ '''
0 commit comments