Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
6a59fbc8
Commit
6a59fbc8
authored
Jan 18, 2018
by
Martin Reinecke
Browse files
small enhancements for data objects
parent
e7b0e33b
Pipeline
#23798
passed with stage
in 4 minutes and 38 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/data_objects/distributed_do.py
View file @
6a59fbc8
...
...
@@ -44,7 +44,7 @@ def _shareRange(nwork, nshares, myshare):
return
lo
,
hi
def
local_shape
(
shape
,
distaxis
):
def
local_shape
(
shape
,
distaxis
=
0
):
if
len
(
shape
)
==
0
or
distaxis
==
-
1
:
return
shape
shape2
=
list
(
shape
)
...
...
@@ -344,6 +344,14 @@ def local_data(arr):
return
arr
.
_data
def
ibegin_from_shape
(
glob_shape
,
distaxis
=
0
):
res
=
[
0
]
*
len
(
glob_shape
)
if
distaxis
<
0
:
return
res
res
[
distaxis
]
=
_shareRange
(
glob_shape
[
distaxis
],
ntask
,
rank
)[
0
]
return
tuple
(
res
)
def
ibegin
(
arr
):
res
=
[
0
]
*
arr
.
_data
.
ndim
res
[
arr
.
_distaxis
]
=
_shareRange
(
arr
.
_shape
[
arr
.
_distaxis
],
ntask
,
rank
)[
0
]
...
...
nifty/data_objects/numpy_do.py
View file @
6a59fbc8
...
...
@@ -47,6 +47,10 @@ def local_data(arr):
return
arr
def
ibegin_from_shape
(
glob_shape
,
distaxis
=-
1
):
return
(
0
,)
*
len
(
glob_shape
)
def
ibegin
(
arr
):
return
(
0
,)
*
arr
.
ndim
...
...
@@ -81,5 +85,5 @@ def default_distaxis():
return
-
1
def
local_shape
(
glob_shape
,
distaxis
):
def
local_shape
(
glob_shape
,
distaxis
=-
1
):
return
glob_shape
nifty/dobj.py
View file @
6a59fbc8
...
...
@@ -31,6 +31,6 @@ except ImportError:
__all__
=
[
"ntask"
,
"rank"
,
"master"
,
"local_shape"
,
"data_object"
,
"full"
,
"empty"
,
"zeros"
,
"ones"
,
"empty_like"
,
"vdot"
,
"abs"
,
"exp"
,
"log"
,
"tanh"
,
"sqrt"
,
"from_object"
,
"from_random"
,
"local_data"
,
"ibegin"
,
"np_allreduce_sum"
,
"distaxis"
,
"from_local_data"
,
"from_global_data"
,
"to_global_data"
,
"local_data"
,
"ibegin"
,
"ibegin_from_shape"
,
"np_allreduce_sum"
,
"distaxis"
,
"from_local_data"
,
"from_global_data"
,
"to_global_data"
,
"redistribute"
,
"default_distaxis"
,
"mprint"
]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment