# coding: utf-8 # # Loopy: Counting Operations # # ## Setup code # In[1]: import numpy as np import pyopencl as cl import pyopencl.array import pyopencl.clrandom import loopy as lp # In[2]: ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) # In[18]: n = 1024 a = cl.clrandom.rand(queue, (n, n), dtype=np.float32) b = cl.clrandom.rand(queue, (n, n), dtype=np.float32) # ## Operation-counting matrix multiplication # Here is the simple matrix-matrix multiplication kernel again: # In[7]: knl = lp.make_kernel( "{[i,j,k]: 0<=i,j,k