Commit 5166fd9c authored by ultimanet's avatar ultimanet
Browse files

Fixed global_configuration MPI import in nifty_los

parent 599d3d2d
...@@ -1876,44 +1876,52 @@ class distributed_data_object(object): ...@@ -1876,44 +1876,52 @@ class distributed_data_object(object):
""" """
cumsum_data = self.distributor.cumsum(self.data, axis=axis) cumsum_data = self.distributor.cumsum(self.data, axis=axis)
result_d2o = self.copy_empty()
if axis is None: if axis is None:
result_d2o = result_d2o.flatten(inplace=True) flat_global_shape = (np.prod(self.shape),)
flat_local_shape = np.shape(cumsum_data)
result_d2o = self.copy_empty(global_shape=flat_global_shape,
local_shape=flat_local_shape)
else:
result_d2o = self.copy_empty()
result_d2o.set_local_data(cumsum_data) result_d2o.set_local_data(cumsum_data)
return result_d2o return result_d2o
def save(self, alias, path=None, overwriteQ=True): def save(self, alias, path=None, overwriteQ=True):
""" """ Saves the distributed_data_object to disk utilizing h5py.
Saves a distributed_data_object to disk utilizing h5py.
Parameters
Parameters ----------
---------- alias : string
alias : string The name for the dataset which is saved within the hdf5 file.
The name for the dataset which is saved within the hdf5 file.
path : string *optional* path : optional[str]
The path to the hdf5 file. If no path is given, the alias is The path to the hdf5 file. If no path is given, the alias is
taken as filename in the current path. taken as filename in the current working directory.
overwriteQ : Boolean *optional* overwriteQ : optional[boolean]
Specifies whether a dataset may be overwritten if it is already Specifies whether a dataset may be overwritten if it is already
present in the given hdf5 file or not. present in the given hdf5 file or not.
""" """
self.distributor.save_data(self.data, alias, path, overwriteQ) self.distributor.save_data(self.data, alias, path, overwriteQ)
def load(self, alias, path=None): def load(self, alias, path=None):
""" """ Loads a distributed_data_object from disk utilizing h5py.
Loads a distributed_data_object from disk utilizing h5py.
Parameters Parameters
---------- ----------
alias : string alias : string
The name of the dataset which is loaded from the hdf5 file. The name of the dataset which is loaded from the hdf5 file.
path : string *optional* path : optional[str]
The path to the hdf5 file. If no path is given, the alias is The path to the hdf5 file. If no path is given, the alias is
taken as filename in the current path. taken as filename in the current path.
""" """
self.data = self.distributor.load_data(alias, path) self.data = self.distributor.load_data(alias, path)
......
...@@ -6,14 +6,17 @@ from line_integrator import multi_integrator, \ ...@@ -6,14 +6,17 @@ from line_integrator import multi_integrator, \
gaussian_error_function gaussian_error_function
from nifty.keepers import about,\ from nifty.keepers import about,\
global_dependency_injector as gdi global_dependency_injector as gdi,\
global_configuration as gc
from nifty.nifty_mpi_data import distributed_data_object,\ from nifty.nifty_mpi_data import distributed_data_object,\
STRATEGIES STRATEGIES
from nifty.nifty_core import point_space,\ from nifty.nifty_core import point_space,\
field field
from nifty.rg import rg_space from nifty.rg import rg_space
from nifty.operators import operator from nifty.operators import operator
MPI = gdi['MPI']
MPI = gdi[gc['mpi_module']]
class los_response(operator): class los_response(operator):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment