Skip to content

Commit

Permalink
using numpy to alter values of service buffer
Browse files Browse the repository at this point in the history
Signed-off-by: arunjose696 <[email protected]>
  • Loading branch information
arunjose696 committed Oct 23, 2023
1 parent 8f19490 commit 2bc6034
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
- cython
- psutil
- pytest
- numpy
# for downloading packages from PyPI
- pip
- pip:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dask[complete]>=2.22.0
distributed>=2.22.0
mpi4py>=3.0.3
msgpack>=1.0.0
numpy
# https://github.com/modin-project/unidist/issues/324
pydantic<2
ray[default]>=1.13.0
Expand Down
7 changes: 3 additions & 4 deletions unidist/core/backends/mpi/core/shared_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time
import psutil
import weakref
from array import array
import numpy as np

from unidist.core.backends.mpi.core._memory import parallel_memcopy
from unidist.core.backends.mpi.utils import ImmutableDict
Expand Down Expand Up @@ -190,9 +190,8 @@ def _allocate_shared_memory(self):
self.service_shared_buffer = memoryview(service_buffer).cast("l")
# Set -1 to the service buffer because 0 is a valid value and may be recognized by mistake.
if mpi_state.is_monitor_process():
self.service_shared_buffer[:] = array(
"l", [-1] * len(self.service_shared_buffer)
)
memoryview_array = np.frombuffer(self.service_shared_buffer, dtype=np.int64)
memoryview_array[:] = -1

def _parse_data_id(self, data_id):
"""
Expand Down

0 comments on commit 2bc6034

Please sign in to comment.