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
Alexander Reinauer
pystencils
Commits
b20974fe
Commit
b20974fe
authored
Jan 23, 2020
by
Stephan Seitz
Browse files
interpolation: Stuff is working let's commit quickly
parent
fa782b82
Changes
3
Hide whitespace changes
Inline
Side-by-side
pystencils/gpucuda/texture_utils.py
View file @
b20974fe
...
...
@@ -15,6 +15,7 @@ import numpy as np
try
:
import
pycuda.driver
as
cuda
from
pycuda
import
gpuarray
import
pycuda
except
Exception
:
pass
...
...
@@ -35,6 +36,8 @@ def ndarray_to_tex(tex_ref,
use_normalized_coordinates
=
False
,
read_as_integer
=
False
):
if
isinstance
(
address_mode
,
str
):
address_mode
=
getattr
(
pycuda
.
driver
.
address_mode
,
address_mode
.
upper
())
if
address_mode
is
None
:
address_mode
=
cuda
.
address_mode
.
BORDER
if
filter_mode
is
None
:
...
...
pystencils/interpolation_astnodes.py
View file @
b20974fe
...
...
@@ -116,7 +116,6 @@ class Interpolator(object):
def
_hashable_contents
(
self
):
return
(
str
(
self
.
address_mode
),
str
(
type
(
self
)),
self
.
address_mode
,
self
.
hash_str
,
self
.
use_normalized_coordinates
)
...
...
@@ -416,11 +415,9 @@ class TextureCachedField(Interpolator):
read_as_integer
=
False
):
super
().
__init__
(
parent_field
,
interpolation_mode
,
address_mode
,
use_normalized_coordinates
)
if
isinstance
(
address_mode
,
str
):
address_mode
=
getattr
(
pycuda
.
driver
.
address_mode
,
address_mode
.
upper
())
if
address_mode
is
None
:
address_mode
=
pycuda
.
driver
.
address_mode
.
BORDER
address_mode
=
'border'
if
filter_mode
is
None
:
filter_mode
=
pycuda
.
driver
.
filter_mode
.
LINEAR
...
...
pystencils/transformations.py
View file @
b20974fe
...
...
@@ -1334,19 +1334,19 @@ def implement_interpolations(ast_node: ast.Node,
if
implement_by_texture_accesses
:
for
i
in
interpolation_accesses
:
old_i
=
i
from
pystencils.interpolation_astnodes
import
_InterpolationSymbol
try
:
import
pycuda.driver
as
cuda
texture
=
TextureCachedField
.
from_interpolator
(
i
.
interpolator
)
i
.
symbol
.
interpolator
=
texture
if
can_use_hw_interpolation
(
i
):
i
.
symbol
.
interpolator
.
filter_mode
=
cuda
.
filter_mode
.
LINEAR
texture
.
filter_mode
=
cuda
.
filter_mode
.
LINEAR
else
:
i
.
symbol
.
interpolator
.
filter_mode
=
cuda
.
filter_mode
.
POINT
i
.
symbol
.
interpolator
.
read_as_integer
=
True
texture
.
filter_mode
=
cuda
.
filter_mode
.
POINT
texture
.
read_as_integer
=
True
except
Exception
as
e
:
raise
e
ast_node
.
subs
({
old_i
:
i
}
)
i
.
symbol
=
_InterpolationSymbol
(
str
(
texture
),
i
.
symbol
.
field
,
texture
)
# from pystencils.math_optimizations import ReplaceOptim, optimize_ast
...
...
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