Skip to content

Commit

Permalink
REFACTOR-#000: Refactor remote function class for MPI backend (#410)
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Suvorov <[email protected]>
  • Loading branch information
Retribution98 authored Dec 12, 2023
1 parent 5b932f9 commit 491272e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions unidist/core/backends/mpi/remote_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""An implementation of ``RemoteFunction`` interface using MPI."""

import unidist.core.backends.mpi.core as mpi
from unidist.core.backends.mpi.core.local_object_store import LocalObjectStore
from unidist.core.backends.common.data_id import is_data_id
from unidist.core.backends.common.utils import unwrap_object_refs
from unidist.core.base.object_ref import ObjectRef
Expand All @@ -30,7 +29,6 @@ class MPIRemoteFunction(RemoteFunction):

def __init__(self, function, num_cpus, num_returns, resources):
self._remote_function = function
self._remote_function_orig = function
self._num_cpus = num_cpus
self._num_returns = 1 if num_returns is None else num_returns
self._resources = resources
Expand Down Expand Up @@ -75,13 +73,7 @@ def _remote(self, *args, num_cpus=None, num_returns=None, resources=None, **kwar
unwrapped_kwargs = {k: unwrap_object_refs(v) for k, v in kwargs.items()}

if not is_data_id(self._remote_function):
self._remote_function = mpi.put(self._remote_function_orig)
else:
# When a worker calls a remote function inside another remote function,
# we have to again serialize the former remote function and put it into the storage
# for further correct communication.
if not LocalObjectStore.get_instance().contains(self._remote_function):
self._remote_function = mpi.put(self._remote_function_orig)
self._remote_function = mpi.put(self._remote_function)

data_ids = mpi.submit(
self._remote_function,
Expand Down

0 comments on commit 491272e

Please sign in to comment.