Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
fee7b4d2
Commit
fee7b4d2
authored
Jul 18, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
1be2685f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
nifty5/data_objects/distributed_do.py
nifty5/data_objects/distributed_do.py
+6
-0
nifty5/data_objects/numpy_do.py
nifty5/data_objects/numpy_do.py
+4
-0
nifty5/dobj.py
nifty5/dobj.py
+1
-0
nifty5/operators/dof_distributor.py
nifty5/operators/dof_distributor.py
+9
-4
No files found.
nifty5/data_objects/distributed_do.py
View file @
fee7b4d2
...
...
@@ -348,6 +348,12 @@ def np_allreduce_min(arr):
return
res
def
np_allreduce_max
(
arr
):
res
=
np
.
empty_like
(
arr
)
_comm
.
Allreduce
(
arr
,
res
,
MPI
.
MAX
)
return
res
def
distaxis
(
arr
):
return
arr
.
_distaxis
...
...
nifty5/data_objects/numpy_do.py
View file @
fee7b4d2
...
...
@@ -75,6 +75,10 @@ def np_allreduce_min(arr):
return
arr
def
np_allreduce_max
(
arr
):
return
arr
def
distaxis
(
arr
):
return
-
1
...
...
nifty5/dobj.py
View file @
fee7b4d2
...
...
@@ -33,6 +33,7 @@ __all__ = ["ntask", "rank", "master", "local_shape", "data_object", "full",
"empty"
,
"zeros"
,
"ones"
,
"empty_like"
,
"vdot"
,
"exp"
,
"log"
,
"tanh"
,
"sqrt"
,
"from_object"
,
"from_random"
,
"local_data"
,
"ibegin"
,
"ibegin_from_shape"
,
"np_allreduce_sum"
,
"np_allreduce_min"
,
"np_allreduce_max"
,
"distaxis"
,
"from_local_data"
,
"from_global_data"
,
"to_global_data"
,
"redistribute"
,
"default_distaxis"
,
"is_numpy"
,
"lock"
,
"locked"
]
nifty5/operators/dof_distributor.py
View file @
fee7b4d2
...
...
@@ -41,9 +41,9 @@ class DOFDistributor(LinearOperator):
----------
dofdex: Field of integers
An integer Field on exactly one Space establishing the association
between the locations in the operators target and the underlying
between the locations in the operator
'
s target and the underlying
degrees of freedom in its domain.
It has to start at 0 and it increases monotonicly, no empty bins are
It has to start at 0 and it increases monotonic
al
ly, no empty bins are
allowed.
target: Domain, tuple of Domain, or DomainTuple, optional
The target of the operator. If not specified, the domain of the dofdex
...
...
@@ -70,12 +70,17 @@ class DOFDistributor(LinearOperator):
if
partner
!=
dofdex
.
domain
[
0
]:
raise
ValueError
(
"incorrect dofdex domain"
)
nbin
=
dofdex
.
max
()
ldat
=
dofdex
.
local_data
if
ldat
.
size
==
0
:
# can happen for weird configurations
nbin
=
0
else
:
nbin
=
ldat
.
max
()
nbin
=
dobj
.
np_allreduce_max
(
np
.
array
(
nbin
))[()]
+
1
if
partner
.
scalar_dvol
is
not
None
:
wgt
=
np
.
bincount
(
dofdex
.
local_data
.
ravel
(),
minlength
=
nbin
)
wgt
=
wgt
*
partner
.
scalar_dvol
else
:
dvol
=
dobj
.
local_data
(
partner
.
dvol
)
dvol
=
Field
.
from_global_data
(
partner
,
partner
.
dvol
).
local_data
wgt
=
np
.
bincount
(
dofdex
.
local_data
.
ravel
(),
minlength
=
nbin
,
weights
=
dvol
)
# The explicit conversion to float64 is necessary because bincount
...
...
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