i want to run some of the code from eric hunsberger repo and come across following piece of code
backend = 'nengo_ocl' if args.ocl else 'nengo'
run(args.loadfile, savefile=args.savefile, histload=args.histload,
count_spikes=args.spikes, n_max=args.n, backend=backend,
what is ocl_profile,how to get this.
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).