class SequentialIterationSuite: """ An example benchmark that times the performance of various kinds of iterating over dictionaries in Python. """ timeout=1000 params = ['python', 'njit', 'njit_parallel'] def setup(self, engine): np.random.seed(0) self.sim = Simulation({}, 108, 100, 1e-6, file_path=None, m=1, T=0, dx=1, save_every_x_iters=1, gpu=False, shape='fcc', engine=engine) def time_run(self, engine): self.sim.run()
def unstable_simulation(request): sim = Simulation( {}, 2, 100, request.param, file_path=None, m=1, T=0, dx=1, save_every_x_iters=1, gpu=False, ) sim.r = np.array([[0, 0, 0], [1, 0, 0]], dtype=float) sim.extrapolate_old_r() sim.run() return sim
def simulation_numba(request): np.random.seed(0) sim = Simulation( {}, 108, 100, 1e-6, file_path=None, m=1, T=0, dx=1, save_every_x_iters=1, gpu=False, shape="fcc", engine=request.param, ) sim.run() return sim
def simulation_python(): np.random.seed(0) sim = Simulation( {}, 108, 100, 1e-6, file_path=None, m=1, T=0, dx=1, save_every_x_iters=1, gpu=False, shape="fcc", engine="python", ) sim.run() return sim