def _run_nl_ln_drv(self, ndv, nstate, nproc, flag): """ Benchmark a single point. Nonlinear solve is always run. Linear Solve and Driver are optional. Parameters ---------- ndv : int Number of design variables requested. nstate : int Number of states requested. nproc : int Number of processors requested. flag : bool User assignable flag that will be False or True. """ prob = Problem() # User hook pre setup self.setup(prob, ndv, nstate, nproc, flag) prob.setup(mode=self.mode) # User hook post setup self.post_setup(prob, ndv, nstate, nproc, flag) prob.final_setup() # Time Execution t0 = time() prob.run_model() t1 = time() - t0 print("Nonlinear Execution complete:", t1, 'sec') if self.time_driver: t4 = time() prob.run_driver() t5 = time() - t4 print("Driver Execution complete:", t5, 'sec') else: t5 = 0.0 if self.time_linear: if self.sub_timing: prob.model.linear_solver.time_lu_fact = 0 prob.model.linear_solver.time_lu_solve = 0 t2 = time() prob.compute_totals(of=self.ln_of, wrt=self.ln_wrt, return_format='dict') t3 = time() - t2 print("Linear Execution complete:", t3, 'sec') if self.sub_timing: t3a = prob.model.linear_solver.time_lu_fact t3b = prob.model.linear_solver.time_lu_solve t3c = prob.total_jac.time_linearize_sys t3d = prob.total_jac.time_lienarize_solver t3e = prob.total_jac.time_solve else: t3 = 0.0 self.post_run(prob, ndv, nstate, nproc, flag) if self.sub_timing and self.time_linear: return t1, t3, t5, t3a, t3b, t3c, t3d, t3e else: return t1, t3, t5