Skip to content
Snippets Groups Projects
Commit 17e09b29 authored by Jean-Matthieu Etancelin's avatar Jean-Matthieu Etancelin
Browse files

small improvements

parent 4f0c310e
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ from hysop.domain.subsets import SubBox ...@@ -48,7 +48,7 @@ from hysop.domain.subsets import SubBox
from hysop.operator.hdf_io import HDF_Writer from hysop.operator.hdf_io import HDF_Writer
from hysop.operator.energy_enstrophy import EnergyEnstrophy from hysop.operator.energy_enstrophy import EnergyEnstrophy
import hysop.tools.numpywrappers as npw 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 #from hysop.tools.io_utils import IO
#IO.set_default_path("/scratch_p/jmetancelin") #IO.set_default_path("/scratch_p/jmetancelin")
pi = np.pi pi = np.pi
...@@ -164,7 +164,7 @@ rho = hysop.Field(domain=box, formula=initRho, ...@@ -164,7 +164,7 @@ rho = hysop.Field(domain=box, formula=initRho,
data = {'dt': 0.001} data = {'dt': 0.001}
dt = VariableParameter(data) 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: # Flow discretizations:
d_uw = Discretization(USER_NB_ELEM_UW) d_uw = Discretization(USER_NB_ELEM_UW)
...@@ -445,7 +445,7 @@ setup_time = MPI.Wtime() - ctime ...@@ -445,7 +445,7 @@ setup_time = MPI.Wtime() - ctime
main_comm.Barrier() main_comm.Barrier()
# Solve # Solve
solve_time = 0. solve_time = FProfiler("Solve")
while not simu.isOver: while not simu.isOver:
ctime = MPI.Wtime() ctime = MPI.Wtime()
if main_rank == 0: if main_rank == 0:
...@@ -476,6 +476,7 @@ if IS_OUTPUT: ...@@ -476,6 +476,7 @@ if IS_OUTPUT:
p_velo.apply(simu) p_velo.apply(simu)
prof = Profiler(None, box.comm_task) prof = Profiler(None, box.comm_task)
prof += solve_time
for op in operators_list: for op in operators_list:
if box.is_on_task(op.task_id()): if box.is_on_task(op.task_id()):
op.finalize() op.finalize()
...@@ -483,7 +484,12 @@ for op in operators_list: ...@@ -483,7 +484,12 @@ for op in operators_list:
for v in (velo, vorti, rho, scal): for v in (velo, vorti, rho, scal):
prof += v.profiler prof += v.profiler
prof.summarize() 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() velo.finalize()
if box.is_on_task(TASK_SCALAR): if box.is_on_task(TASK_SCALAR):
......
...@@ -41,8 +41,9 @@ class FProfiler(object): ...@@ -41,8 +41,9 @@ class FProfiler(object):
def __str__(self): def __str__(self):
if self.n > 0: if self.n > 0:
s = "- {0} : {1} s ({2} calls)".format( s = "- {0} : {1} s ({2} call{3})".format(
self.fname, self.t, self.n) self.fname, self.t, self.n,
's' if self.n > 1 else '')
else: else:
s = "" s = ""
return s return s
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment