102102
103103"""
104104 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:
106106 1) install theano:
107107 sudo python3.5 -m pip install Theano
108108 2) download and install the latest cuda:
111111 http://askubuntu.com/questions/760242/how-can-i-force-16-04-to-add-a-repository-even-if-it-isnt-considered-secure-eno
112112 You may also want to grab the proper NVidia driver, choose it form there:
113113 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+
115120
116121"""
117122
@@ -120,7 +125,7 @@ def testTheano():
120125 import theano .tensor as T
121126 import numpy
122127 import time
123-
128+ print ( "Testing Theano library..." )
124129 vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
125130 iters = 1000
126131
@@ -140,17 +145,19 @@ def testTheano():
140145 print ('Used the gpu' )
141146
142147# Perform check:
143- # testTheano()
148+ testTheano ()
144149
145150
146151# ----------------------
147152# - network3.py example:
148153import network3
149154
155+ '''
150156from network3 import ConvPoolLayer, FullyConnectedLayer, SoftmaxLayer
151157training_data, validation_data, test_data = network3.load_data_shared()
152158mini_batch_size = 10
153159net = network3.Network([
154160 FullyConnectedLayer(n_in=784, n_out=100),
155161 SoftmaxLayer(n_in=100, n_out=10)], mini_batch_size)
156162net.SGD(training_data, 60, mini_batch_size, 0.1, validation_data, test_data)
163+ '''
0 commit comments