Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
56f93fd8
Commit
56f93fd8
authored
Nov 09, 2017
by
Martin Reinecke
Browse files
fixes
parent
498c13aa
Pipeline
#21276
failed with stage
in 4 minutes
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
nifty/data_objects/distributed_do.py
View file @
56f93fd8
...
@@ -18,6 +18,8 @@ def shareRange(nwork, nshares, myshare):
...
@@ -18,6 +18,8 @@ def shareRange(nwork, nshares, myshare):
return
lo
,
hi
return
lo
,
hi
def
get_locshape
(
shape
,
distaxis
):
def
get_locshape
(
shape
,
distaxis
):
if
len
(
shape
)
==
0
:
distaxis
=
-
1
if
distaxis
==-
1
:
if
distaxis
==-
1
:
return
shape
return
shape
if
distaxis
<
0
or
distaxis
>=
len
(
shape
):
if
distaxis
<
0
or
distaxis
>=
len
(
shape
):
...
@@ -32,6 +34,8 @@ class data_object(object):
...
@@ -32,6 +34,8 @@ class data_object(object):
def
__init__
(
self
,
shape
,
data
,
distaxis
):
def
__init__
(
self
,
shape
,
data
,
distaxis
):
"""Must not be called directly by users"""
"""Must not be called directly by users"""
self
.
_shape
=
tuple
(
shape
)
self
.
_shape
=
tuple
(
shape
)
if
len
(
self
.
_shape
)
==
0
:
distaxis
=
-
1
self
.
_distaxis
=
distaxis
self
.
_distaxis
=
distaxis
lshape
=
get_locshape
(
self
.
_shape
,
self
.
_distaxis
)
lshape
=
get_locshape
(
self
.
_shape
,
self
.
_distaxis
)
self
.
_data
=
data
self
.
_data
=
data
...
@@ -238,7 +242,7 @@ def vdot(a, b):
...
@@ -238,7 +242,7 @@ def vdot(a, b):
tmp
=
np
.
vdot
(
a
.
_data
.
ravel
(),
b
.
_data
.
ravel
())
tmp
=
np
.
vdot
(
a
.
_data
.
ravel
(),
b
.
_data
.
ravel
())
res
=
np
.
empty
(
1
,
dtype
=
type
(
tmp
))
res
=
np
.
empty
(
1
,
dtype
=
type
(
tmp
))
comm
.
Allreduce
(
tmp
,
res
,
MPI
.
SUM
)
comm
.
Allreduce
(
tmp
,
res
,
MPI
.
SUM
)
return
res
return
res
[
0
]
def
_math_helper
(
x
,
function
,
out
):
def
_math_helper
(
x
,
function
,
out
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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