If you scroll down to the section where
ocl_profile is used, you’ll see how I do some basic profiling:
with nengo_ocl.Simulator(network, profiling=True) as sim:
The first important thing here is passing
profiling=True when you make the simulator. This tells the simulator you want to record profiling information (which makes the simulator slower, so it’s not something you want to do all the time, only when you’re trying to see what’s slow).
The second part is calling
sim.print_profiling, after you’ve run the simulator for a bit. (The length of time you run for is up to you. If you run longer, you’ll call each OCL kernel more times, which should give you a better estimate of how long each one takes.) Passing the
sort=1 argument sorts by the first column, which is total execution time for each kernel. (There’s a bit more information in the docstring).