but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and the GNU Lesser General Public License along with pyDive. If not, see <http://www.gnu.org/licenses/>. """ __doc__ = None import numpy as np import pyDive.distribution.multiple_axes as multiple_axes from pyDive.distribution.interengine import MPI_copier ndarray = multiple_axes.distribute(np.ndarray, "ndarray", "np", interengine_copier=MPI_copier) factories = multiple_axes.generate_factories(ndarray, ("empty", "zeros", "ones"), np.float) factories.update(multiple_axes.generate_factories_like(ndarray, ("empty_like", "zeros_like", "ones_like"))) globals().update(factories) def array(array_like, distaxes='all'): """Create a pyDive.ndarray instance from an array-like object. :param array_like: Any object exposing the array interface, e.g. numpy-array, python sequence, ... :param ints distaxes: distributed axes. Defaults to 'all' meaning each axis is distributed. """ np_array = np.array(array_like) result = empty(np_array.shape, np_array.dtype, distaxes) result[:] = np_array
You should have received a copy of the GNU General Public License and the GNU Lesser General Public License along with pyDive. If not, see <http://www.gnu.org/licenses/>. """ __doc__ = None import numpy as np import adios as ad from pyDive.arrays.ndarray import hollow_like import pyDive.distribution.multiple_axes as multiple_axes import pyDive.IPParallelClient as com from itertools import islice from .. import structured import pyDive.arrays.local.ad_ndarray ad_ndarray = multiple_axes.distribute(pyDive.arrays.local.ad_ndarray.ad_ndarray, "ad_ndarray", "ad_ndarray", may_allocate=False) def load(self): """Load array from file into main memory of all engines in parallel. :return: pyDive.ndarray instance """ result = hollow_like(self) view = com.getView() view.execute("{0} = {1}.load()".format(result.name, self.name), targets=result.target_ranks) return result ad_ndarray.load = load del load def open_variable(filename, variable_path, distaxis=0): """Create a pyDive.adios.ad_ndarray instance from file.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and the GNU Lesser General Public License along with pyDive. If not, see <http://www.gnu.org/licenses/>. """ __doc__ = None import numpy as np import pyDive.distribution.multiple_axes as multiple_axes from pyDive.distribution.interengine import GPU_copier import pyDive.arrays.local.gpu_ndarray gpu_ndarray = multiple_axes.distribute(pyDive.arrays.local.gpu_ndarray.gpu_ndarray, "gpu_ndarray",\ "pyDive.arrays.local.gpu_ndarray", interengine_copier=GPU_copier) factories = multiple_axes.generate_factories(gpu_ndarray, ("empty", "zeros"), np.float) factories.update( multiple_axes.generate_factories_like(gpu_ndarray, ("empty_like", "zeros_like"))) globals().update(factories) def ones(shape, dtype=np.float, distaxes='all', **kwargs): result = zeros(shape, dtype, distaxes, **kwargs) result += 1 return result
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and the GNU Lesser General Public License for more details. You should have received a copy of the GNU General Public License and the GNU Lesser General Public License along with pyDive. If not, see <http://www.gnu.org/licenses/>. """ __doc__ = None import numpy as np import pyDive.distribution.multiple_axes as multiple_axes from pyDive.distribution.interengine import MPI_copier ndarray = multiple_axes.distribute(np.ndarray, "ndarray", "np", interengine_copier=MPI_copier) factories = multiple_axes.generate_factories(ndarray, ("empty", "zeros", "ones"), np.float) factories.update( multiple_axes.generate_factories_like( ndarray, ("empty_like", "zeros_like", "ones_like"))) globals().update(factories) def array(array_like, distaxes='all'): """Create a pyDive.ndarray instance from an array-like object.
for more details. You should have received a copy of the GNU General Public License and the GNU Lesser General Public License along with pyDive. If not, see <http://www.gnu.org/licenses/>. """ __doc__ = None import numpy as np import pyDive.distribution.multiple_axes as multiple_axes from pyDive.distribution.interengine import GPU_copier import pyDive.arrays.local.gpu_ndarray gpu_ndarray = multiple_axes.distribute( pyDive.arrays.local.gpu_ndarray.gpu_ndarray, "gpu_ndarray", "pyDive.arrays.local.gpu_ndarray", interengine_copier=GPU_copier, ) factories = multiple_axes.generate_factories(gpu_ndarray, ("empty", "zeros"), np.float) factories.update(multiple_axes.generate_factories_like(gpu_ndarray, ("empty_like", "zeros_like"))) globals().update(factories) def ones(shape, dtype=np.float, distaxes="all", **kwargs): result = zeros(shape, dtype, distaxes, **kwargs) result += 1 return result def ones_like(other, **kwargs):