Skip to content

Commit

Permalink
fix black
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed May 27, 2024
1 parent 6fba7c1 commit e9cdbc9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
14 changes: 8 additions & 6 deletions unidist/core/backends/mpi/core/monitor/shared_memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ def clear(self, data_id_list):
has_refs = array(
"B",
[
1
if data_id in self._reservation_info
and self.shared_store.get_ref_number(
data_id, self._reservation_info[data_id]["service_index"]
(
1
if data_id in self._reservation_info
and self.shared_store.get_ref_number(
data_id, self._reservation_info[data_id]["service_index"]
)
> 0
else 0
)
> 0
else 0
for data_id in cleanup_list
],
)
Expand Down
28 changes: 16 additions & 12 deletions unidist/core/backends/mpi/core/shared_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,11 @@ def _allocate_shared_memory(self):
info = MPI.Info.Create()
info.Set("alloc_shared_noncontig", "true")
self.win = MPI.Win.Allocate_shared(
self.shared_memory_size * MPI.BYTE.size
if mpi_state.is_monitor_process()
else 0,
(
self.shared_memory_size * MPI.BYTE.size
if mpi_state.is_monitor_process()
else 0
),
MPI.BYTE.size,
comm=mpi_state.host_comm,
info=info,
Expand All @@ -245,9 +247,11 @@ def _allocate_shared_memory(self):
* self.INFO_SIZE
)
self.service_win = MPI.Win.Allocate_shared(
self.service_info_max_count * MPI.LONG.size
if mpi_state.is_monitor_process()
else 0,
(
self.service_info_max_count * MPI.LONG.size
if mpi_state.is_monitor_process()
else 0
),
MPI.LONG.size,
comm=mpi_state.host_comm,
info=info,
Expand Down Expand Up @@ -363,13 +367,13 @@ def _put_service_info(self, service_index, data_id, first_index):
worker_id, data_number = self._parse_data_id(data_id)

with WinLock(self.service_win):
self.service_shared_buffer[
service_index + self.FIRST_DATA_INDEX
] = first_index
self.service_shared_buffer[service_index + self.FIRST_DATA_INDEX] = (
first_index
)
self.service_shared_buffer[service_index + self.REFERENCES_NUMBER] = 1
self.service_shared_buffer[
service_index + self.DATA_NUMBER_INDEX
] = data_number
self.service_shared_buffer[service_index + self.DATA_NUMBER_INDEX] = (
data_number
)
self.service_shared_buffer[service_index + self.WORKER_ID_INDEX] = worker_id

self.finalizers.append(
Expand Down

0 comments on commit e9cdbc9

Please sign in to comment.