Skip to content

Commit

Permalink
better timing (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
keskitalo authored Dec 19, 2023
1 parent d24a5fe commit 1b17c7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/toast/ops/filterbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,8 +1579,12 @@ def _bin_map(self, data, detectors, filtered):
save_pointing=self.binning.full_pointing,
)
cov.apply(data, detectors=detectors)
log.info_rank(
f"Binned covariance and hits in", comm=self.comm, timer=timer
)

self.binning.apply(data, detectors=detectors)
log.info_rank(f"Binned signal in", comm=self.comm, timer=timer)

mc_root = self.name
if self.mc_mode:
Expand Down
13 changes: 5 additions & 8 deletions src/toast/ops/mapmaker_binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from ..covariance import covariance_apply
from ..observation import default_values as defaults
from ..timing import function_timer
from ..timing import Timer, function_timer
from ..traits import Bool, Instance, Int, Unicode, Unit, trait_docs
from ..utils import Logger
from .delete import Delete
Expand Down Expand Up @@ -158,14 +158,15 @@ def __init__(self, **kwargs):
@function_timer
def _exec(self, data, detectors=None, **kwargs):
log = Logger.get()
timer = Timer()
timer.start()

for trait in "pixel_pointing", "stokes_weights":
for trait in "pixel_pointing", "stokes_weights", "det_data":
if getattr(self, trait) is None:
msg = f"You must set the '{trait}' trait before calling exec()"
raise RuntimeError(msg)

if data.comm.world_rank == 0:
log.verbose(" BinMap building pipeline")
log.verbose_rank(" BinMap building pipeline", comm=data.comm.comm_world)

if self.covariance not in data:
msg = f"Data does not contain noise covariance '{self.covariance}'"
Expand All @@ -181,10 +182,6 @@ def _exec(self, data, detectors=None, **kwargs):
log.error(msg)
raise RuntimeError(msg)

# Check that the detector data is set
if self.det_data is None:
raise RuntimeError("You must set the det_data trait before calling exec()")

# Sanity check that the covariance pixel distribution agrees
if cov.distribution != data[self.pixel_dist]:
msg = (
Expand Down
3 changes: 3 additions & 0 deletions src/toast/ops/mapmaker_utils/mapmaker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _exec(self, data, detectors=None, use_accel=None, **kwargs):
)
return

@function_timer
def _finalize(self, data, **kwargs):
if self.hits in data:
if self.sync_type == "alltoallv":
Expand Down Expand Up @@ -473,6 +474,7 @@ def _exec(self, data, detectors=None, use_accel=None, **kwargs):
)
return

@function_timer
def _finalize(self, data, **kwargs):
if self.inverse_covariance in data:
if self.sync_type == "alltoallv":
Expand Down Expand Up @@ -823,6 +825,7 @@ def _exec(self, data, detectors=None, use_accel=None, **kwargs):

return

@function_timer
def _finalize(self, data, use_accel=None, **kwargs):
if self.zmap in data:
log = Logger.get()
Expand Down

0 comments on commit 1b17c7e

Please sign in to comment.