Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
grudge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
grudge
Commits
a3f54cb0
Commit
a3f54cb0
authored
3 years ago
by
Matt Smith
Browse files
Options
Downloads
Patches
Plain Diff
remove force_device_scalars handling
not needed anymore after pyopencl update
parent
214e865b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
grudge/reductions.py
+6
-42
6 additions, 42 deletions
grudge/reductions.py
with
6 additions
and
42 deletions
grudge/reductions.py
+
6
−
42
View file @
a3f54cb0
...
...
@@ -203,27 +203,9 @@ def nodal_min_loc(dcoll: DiscretizationCollection, dd, vec) -> Any:
actx
=
vec
.
array_context
if
hasattr
(
actx
,
"
_force_device_scalars
"
):
force_device_scalars
=
actx
.
_force_device_scalars
else
:
force_device_scalars
=
True
def
as_device_scalar
(
x
):
return
actx
.
from_numpy
(
np
.
array
(
x
))
def
device_min
(
x
):
result
=
actx
.
np
.
min
(
x
)
if
not
force_device_scalars
:
result
=
as_device_scalar
(
result
)
return
result
result
=
reduce
(
lambda
acc
,
grp_ary
:
actx
.
np
.
minimum
(
acc
,
device_min
(
grp_ary
)),
vec
,
as_device_scalar
(
np
.
inf
))
if
not
force_device_scalars
:
result
=
actx
.
to_numpy
(
result
)[()]
return
result
return
reduce
(
lambda
acc
,
grp_ary
:
actx
.
np
.
minimum
(
acc
,
actx
.
np
.
min
(
grp_ary
)),
vec
,
actx
.
from_numpy
(
np
.
array
(
np
.
inf
)))
def
nodal_max
(
dcoll
:
DiscretizationCollection
,
dd
,
vec
)
->
Any
:
...
...
@@ -261,27 +243,9 @@ def nodal_max_loc(dcoll: DiscretizationCollection, dd, vec) -> Any:
actx
=
vec
.
array_context
if
hasattr
(
actx
,
"
_force_device_scalars
"
):
force_device_scalars
=
actx
.
_force_device_scalars
else
:
force_device_scalars
=
True
def
as_device_scalar
(
x
):
return
actx
.
from_numpy
(
np
.
array
(
x
))
def
device_max
(
x
):
result
=
actx
.
np
.
max
(
x
)
if
not
force_device_scalars
:
result
=
as_device_scalar
(
result
)
return
result
result
=
reduce
(
lambda
acc
,
grp_ary
:
actx
.
np
.
maximum
(
acc
,
device_max
(
grp_ary
)),
vec
,
as_device_scalar
(
-
np
.
inf
))
if
not
force_device_scalars
:
result
=
actx
.
to_numpy
(
result
)[()]
return
result
return
reduce
(
lambda
acc
,
grp_ary
:
actx
.
np
.
maximum
(
acc
,
actx
.
np
.
max
(
grp_ary
)),
vec
,
actx
.
from_numpy
(
np
.
array
(
-
np
.
inf
)))
def
integral
(
dcoll
:
DiscretizationCollection
,
dd
,
vec
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment