Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
0df63c2d
Commit
0df63c2d
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Additional tests for packinfo generation & fast approximation for div and sqrt
parent
f780194d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils_tests/test_cudagpu.py
+6
-1
6 additions, 1 deletion
pystencils_tests/test_cudagpu.py
pystencils_tests/test_fast_approximation.py
+8
-1
8 additions, 1 deletion
pystencils_tests/test_fast_approximation.py
with
14 additions
and
2 deletions
pystencils_tests/test_cudagpu.py
+
6
−
1
View file @
0df63c2d
...
@@ -4,7 +4,7 @@ from pystencils import Field, Assignment
...
@@ -4,7 +4,7 @@ from pystencils import Field, Assignment
from
pystencils.simp
import
sympy_cse_on_assignment_list
from
pystencils.simp
import
sympy_cse_on_assignment_list
from
pystencils.gpucuda.indexing
import
LineIndexing
from
pystencils.gpucuda.indexing
import
LineIndexing
from
pystencils.slicing
import
remove_ghost_layers
,
add_ghost_layers
,
make_slice
from
pystencils.slicing
import
remove_ghost_layers
,
add_ghost_layers
,
make_slice
from
pystencils.gpucuda
import
make_python_function
,
create_cuda_kernel
from
pystencils.gpucuda
import
make_python_function
,
create_cuda_kernel
,
BlockIndexing
import
pycuda.gpuarray
as
gpuarray
import
pycuda.gpuarray
as
gpuarray
from
scipy.ndimage
import
convolve
from
scipy.ndimage
import
convolve
...
@@ -145,3 +145,8 @@ def test_periodicity():
...
@@ -145,3 +145,8 @@ def test_periodicity():
periodic_gpu_kernel
(
pdfs
=
arr_gpu
)
periodic_gpu_kernel
(
pdfs
=
arr_gpu
)
arr_gpu
.
get
(
gpu_result
)
arr_gpu
.
get
(
gpu_result
)
np
.
testing
.
assert_equal
(
cpu_result
,
gpu_result
)
np
.
testing
.
assert_equal
(
cpu_result
,
gpu_result
)
def
test_block_size_limiting
():
res
=
BlockIndexing
.
limit_block_size_to_device_maximum
((
4096
,
4096
,
4096
))
assert
all
(
r
<
4096
for
r
in
res
)
This diff is collapsed.
Click to expand it.
pystencils_tests/test_fast_approximation.py
+
8
−
1
View file @
0df63c2d
...
@@ -10,11 +10,18 @@ def test_fast_sqrt():
...
@@ -10,11 +10,18 @@ def test_fast_sqrt():
assert
len
(
insert_fast_sqrts
(
expr
).
atoms
(
fast_sqrt
))
==
1
assert
len
(
insert_fast_sqrts
(
expr
).
atoms
(
fast_sqrt
))
==
1
assert
len
(
insert_fast_sqrts
([
expr
])[
0
].
atoms
(
fast_sqrt
))
==
1
assert
len
(
insert_fast_sqrts
([
expr
])[
0
].
atoms
(
fast_sqrt
))
==
1
ast
=
ps
.
create_kernel
(
ps
.
Assignment
(
g
[
0
,
0
],
insert_fast_sqrts
(
expr
)),
target
=
'
gpu
'
)
code_str
=
str
(
ps
.
show_code
(
ast
))
assert
'
__fsqrt_rn
'
in
code_str
expr
=
3
/
sp
.
sqrt
(
f
[
0
,
0
]
+
f
[
1
,
0
])
expr
=
ps
.
Assignment
(
sp
.
Symbol
(
"
tmp
"
),
3
/
sp
.
sqrt
(
f
[
0
,
0
]
+
f
[
1
,
0
])
)
assert
len
(
insert_fast_sqrts
(
expr
).
atoms
(
fast_inv_sqrt
))
==
1
assert
len
(
insert_fast_sqrts
(
expr
).
atoms
(
fast_inv_sqrt
))
==
1
ac
=
ps
.
AssignmentCollection
([
expr
],
[])
ac
=
ps
.
AssignmentCollection
([
expr
],
[])
assert
len
(
insert_fast_sqrts
(
ac
).
main_assignments
[
0
].
atoms
(
fast_inv_sqrt
))
==
1
assert
len
(
insert_fast_sqrts
(
ac
).
main_assignments
[
0
].
atoms
(
fast_inv_sqrt
))
==
1
ast
=
ps
.
create_kernel
(
insert_fast_sqrts
(
ac
),
target
=
'
gpu
'
)
code_str
=
str
(
ps
.
show_code
(
ast
))
assert
'
__frsqrt_rn
'
in
code_str
def
test_fast_divisions
():
def
test_fast_divisions
():
...
...
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