diff --git a/pennylane/concurrency/executors/external/mpi.py b/pennylane/concurrency/executors/external/mpi.py index 5b36e059d3b..67fff5191f5 100644 --- a/pennylane/concurrency/executors/external/mpi.py +++ b/pennylane/concurrency/executors/external/mpi.py @@ -56,7 +56,7 @@ def __init__(self, max_workers: Optional[int] = None, persist: bool = False, **k # Handle set-up upon object creation only. from mpi4py import MPI - self._size = max_workers + self._size = max_workers if max_workers else MPI.COMM_WORLD.Get_size() - 1 self._comm = MPI.COMM_WORLD self._cfg = ExecBackendConfig( @@ -84,10 +84,6 @@ def __call__(self, dispatch: str, fn: Callable, *args, **kwargs): **kwargs, ) - @property - def size(self): - return self._size - def submit(self, fn: Callable, *args, **kwargs): with self._exec_backend()(max_workers=self.size, use_pkl5=True) as executor: output_f = executor.submit(fn, *args, **kwargs) @@ -194,10 +190,6 @@ def starmap(self, fn: Callable, args: Sequence[tuple], **kwargs): output_f = executor.starmap(fn, args, chunksize=chunksize, **kwargs) return list(output_f) - @property - def size(self): - return self._size - def shutdown(self): "Shutdown the executor backend, if valid."