Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions dicodile/workers/dicod_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,45 @@ def compute_z_hat(self):
for u_slice in lock_slices
])
soft_locked = max_on_lock > abs(dz)
if max_on_lock == abs(dz):
self.info("soft lock for ==")
# {pt_global} == {pt_max}, "
# f"({locking_worker})")
# # Resolve equalities
# slice_max = lock_slices[np.argmax([
# abs(self.dz_opt[u_slice]).max()
# for u_slice in lock_slices
# ])]
# pt_max = np.unravel_index(
# abs(self.dz_opt[slice_max]).argmax(),
# self.dz_opt[slice_max].shape
# )[1:]
# pt_max = tuple(
# s.start + v
# for v, s in zip(pt_max, slice_max[1:])
# )
# pt_max = (
# self.workers_segments
# .get_global_coordinate(self.rank, pt_max)
# )
# locking_worker = (
# self.workers_segments.get_touched_segments(
# pt_max, radius=0
# )
# )
# locking_worker = locking_worker[0]

# pt_global = (
# self.workers_segments.get_global_coordinate(
# self.rank, pt0
# )
# )

# soft_locked = locking_worker < self.rank
# if ii > 10000:
# print(self.rank, "soft lock ==")
# np.save(f'dump_{self.rank}.npy', self.dz_opt)
# time.sleep(10)

# Update the selected coordinate and beta, only if the update is
# greater than the convergence tolerance and is contained in the
Expand Down Expand Up @@ -163,6 +202,8 @@ def compute_z_hat(self):
if self.timing:
self._log_updates.append((t_run, ii, self.rank,
k0, pt_global, dz))
# elif soft_locked:
# time.sleep(.1)

# Inactivate the current segment if the magnitude of the update is
# too small. This only work when using LGCD.
Expand Down