diff --git a/Examples/RMI/RMI_hybrid.py b/Examples/RMI/RMI_hybrid.py index 223e7d87476b214a8b1ba41164e8fba1953d5f24..887ca9459dcc085d6c5b1e3e354fbc954b289678 100644 --- a/Examples/RMI/RMI_hybrid.py +++ b/Examples/RMI/RMI_hybrid.py @@ -48,7 +48,7 @@ from hysop.domain.subsets import SubBox from hysop.operator.hdf_io import HDF_Writer from hysop.operator.energy_enstrophy import EnergyEnstrophy import hysop.tools.numpywrappers as npw -from hysop.tools.profiler import Profiler +from hysop.tools.profiler import Profiler, FProfiler #from hysop.tools.io_utils import IO #IO.set_default_path("/scratch_p/jmetancelin") pi = np.pi @@ -164,7 +164,7 @@ rho = hysop.Field(domain=box, formula=initRho, data = {'dt': 0.001} dt = VariableParameter(data) -simu = Simulation(tinit=0.0, tend=100., timeStep=0.001, iterMax=1) +simu = Simulation(tinit=0.0, tend=100., timeStep=0.001, iterMax=1000000) # Flow discretizations: d_uw = Discretization(USER_NB_ELEM_UW) @@ -445,7 +445,7 @@ setup_time = MPI.Wtime() - ctime main_comm.Barrier() # Solve -solve_time = 0. +solve_time = FProfiler("Solve") while not simu.isOver: ctime = MPI.Wtime() if main_rank == 0: @@ -476,6 +476,7 @@ if IS_OUTPUT: p_velo.apply(simu) prof = Profiler(None, box.comm_task) +prof += solve_time for op in operators_list: if box.is_on_task(op.task_id()): op.finalize() @@ -483,7 +484,12 @@ for op in operators_list: for v in (velo, vorti, rho, scal): prof += v.profiler prof.summarize() -print prof + +for i in xrange(main_size): + if i == main_rank: + print "Solving Time:", solve_time + print prof + main_comm.Barrier() velo.finalize() if box.is_on_task(TASK_SCALAR): diff --git a/HySoP/hysop/tools/profiler.py b/HySoP/hysop/tools/profiler.py index 73b2c3fdd18da1b2caa9957a5e64a3b02eaac263..bd71b01ebe3c48e180cbce6c94c7005677c8cb2e 100644 --- a/HySoP/hysop/tools/profiler.py +++ b/HySoP/hysop/tools/profiler.py @@ -41,8 +41,9 @@ class FProfiler(object): def __str__(self): if self.n > 0: - s = "- {0} : {1} s ({2} calls)".format( - self.fname, self.t, self.n) + s = "- {0} : {1} s ({2} call{3})".format( + self.fname, self.t, self.n, + 's' if self.n > 1 else '') else: s = "" return s