Experiment | GPU (sec) | CPU (sec) |
allow_gc=True; float32 | 0.43 | 15.44 |
allow_gc=False float32 | 0.295 | 15.43 |
float64; allow_gc=True | 3.85 | 3.86 |
float64; allow_gc=False | 3.87 | 3.87 |
I am looking for what I am missing, any hints are appreciated.
Thanks for the insight, I see what you are saying in the logs. Actually, I index a large matrix to lookup the words embeddings.
I think I can implement indexing as a multiplication with a sparse matrix, will that speed up things? As far as I understand sparse operations will be executed at the CPU.
[('float32', 11), ('float64', 12), ('int16', 3), ('int32', 5), ('int32', 7), ('int64', 9), ('int8', 1), ('uint16', 4), ('uint32', 6), ('uint32', 8), ('uint64', 10), ('uint8', 2)] (False, False) <class 'theano.tensor.basic.TensorVariable'> DimShuffle{1,0}.0 2 [[29 16 54 40 75 40 5 39 39] [50 6 59 45 47 92 86 18 68] [ 1 25 72 81 69 22 46 21 51] [53 97 64 26 47 74 13 20 78] [34 40 28 16 13 32 89 7 27] [95 82 4 25 49 57 99 50 7] [ 4 55 6 6 67 53 69 0 1] [71 20 39 55 53 92 67 11 35] [ 6 75 10 92 48 51 73 43 82]]
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-137-8377cf2e4203> in <module>() 49 print '=================================' 50 ---> 51 result = f(i, a) 52 print result 53 /usr/local/lib/python2.7/dist-packages/Theano-0.6.0rc1-py2.7.egg/theano/compile/function_module.pyc in __call__(self, *args, **kwargs) 672 # the C VM needs this because the exception manipulation 673 # done by raise_with_op is not implemented in C. --> 674 gof.vm.raise_with_op(self.fn.nodes[self.fn.position_of_error]) 675 else: 676 # old-style linkers raise their own exceptions /usr/local/lib/python2.7/dist-packages/Theano-0.6.0rc1-py2.7.egg/theano/compile/function_module.pyc in __call__(self, *args, **kwargs) 666 t0_fn = time.time() 667 try: --> 668 outputs = self.fn() 669 except Exception: 670 if hasattr(self.fn, 'position_of_error'): TypeError: expected type_num 7 (NPY_INT32) got 5
=================================