Theano GPU vs pure Numpy (CPU)

In this benchmark, I’ve used a Windows 10 Pro 64 Bit computer with Intel Core i7 6700HQ 2.60 GHz with 32 Gb RAM and NVIDIA GeForce GTX 960M. As a programming environment, I’ve used Python 2.7 (Anaconda distribution) and Jupyter. The task is very simple, integrating this expression (simple but effective): The code I’ve written is this (without matplotlib functions and float32 numbers, in order to use the GPU): import math from datetime import datetime import numpy as np import matplotlib.pyplot as plt import theano import theano.tensor as T from theano import function, shared # Define constants a = 0 b = math.pi precision = 10000000.0 delta = ((b-a) / precision) # Define x linear space xs = np.linspace(a, b, num=precision).astype(np.float32) # Define Theano function xss = shared(xs, ‘xss’) deltas = shared(delta, ‘delta’) sinvx = T.sum(T.sin(xss) * deltas) sf = function([], sinvx) # Number of iterations num_executions = 500 execution_times = […]