From 03a8b9385b4a8ef369588fc7e0ceb12b9a90e5d8 Mon Sep 17 00:00:00 2001 From: theos <theo.steininger@ultimanet.de> Date: Mon, 2 May 2016 03:39:31 +0200 Subject: [PATCH] Fixed two bugs related to the contraction_helper and the mpi_operator translator. --- d2o/distributor_factory.py | 3 +-- d2o/translate_to_mpi_operator.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/d2o/distributor_factory.py b/d2o/distributor_factory.py index 12a6f8396..a1ab4648c 100644 --- a/d2o/distributor_factory.py +++ b/d2o/distributor_factory.py @@ -602,11 +602,10 @@ class _slicing_distributor(distributor): contracted_global_data = contracted_local_data new_dist_strategy = parent.distribution_strategy - new_dtype = contracted_global_data.dtype - if new_shape == (): result = contracted_global_data else: + new_dtype = contracted_global_data.dtype # try to store the result in a distributed_data_object with the # distribution_strategy as parent result = parent.copy_empty(global_shape=new_shape, diff --git a/d2o/translate_to_mpi_operator.py b/d2o/translate_to_mpi_operator.py index 175f7964c..ee38aaa91 100644 --- a/d2o/translate_to_mpi_operator.py +++ b/d2o/translate_to_mpi_operator.py @@ -10,12 +10,12 @@ MPI = gdi[gc['mpi_module']] custom_MIN = MPI.Op.Create(lambda x, y, datatype: np.amin(np.vstack((x, y)), axis=0) if isinstance(x, np.ndarray) else - lambda x, y, d: MPI.MIN(x, y)) + min(x, y)) custom_MAX = MPI.Op.Create(lambda x, y, datatype: np.amax(np.vstack((x, y)), axis=0) if isinstance(x, np.ndarray) else - lambda x, y, d: MPI.MAX(x, y)) + max(x, y)) custom_NANMIN = MPI.Op.Create(lambda x, y, datatype: np.nanmin(np.vstack((x, y)), axis=0)) -- GitLab