Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
psaap3-weno
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
psaap3-weno
Commits
340b78d8
Commit
340b78d8
authored
5 years ago
by
Timothy A. Smith
Browse files
Options
Downloads
Patches
Plain Diff
create new kernel_fixtures.py for direct interface with Loopy kernels
parent
578dc7c4
No related branches found
No related tags found
1 merge request
!8
Test refactoring
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fixtures.py
+0
-10
0 additions, 10 deletions
fixtures.py
kernel_fixtures.py
+15
-0
15 additions, 0 deletions
kernel_fixtures.py
test.py
+4
-2
4 additions, 2 deletions
test.py
with
19 additions
and
12 deletions
fixtures.py
+
0
−
10
View file @
340b78d8
...
...
@@ -92,16 +92,6 @@ def f_array(queue, *shape):
ary
=
np
.
random
.
random_sample
(
shape
).
astype
(
np
.
float32
).
copy
(
order
=
"
F
"
)
return
cl
.
array
.
to_device
(
queue
,
ary
)
def
mult_mat_vec
(
ctx_factory
,
alpha
,
a
,
b
):
queue
=
get_queue
(
ctx_factory
)
c_dev
=
cl
.
array
.
empty
(
queue
,
10
,
dtype
=
np
.
float32
)
prg
=
with_root_kernel
(
get_weno_program
(),
"
mult_mat_vec
"
)
prg
(
queue
,
a
=
a
,
b
=
b
,
c
=
c_dev
,
alpha
=
alpha
)
return
c_dev
.
get
()
def
compute_flux_derivatives
(
ctx_factory
,
nvars
,
ndim
,
nx
,
ny
,
nz
,
states
,
fluxes
,
metrics
,
metric_jacobians
):
...
...
This diff is collapsed.
Click to expand it.
kernel_fixtures.py
0 → 100644
+
15
−
0
View file @
340b78d8
import
numpy
as
np
import
pyopencl
as
cl
import
fixtures
def
mult_mat_vec
(
ctx_factory
,
alpha
,
a
,
b
):
queue
=
fixtures
.
get_queue
(
ctx_factory
)
c_dev
=
cl
.
array
.
empty
(
queue
,
10
,
dtype
=
np
.
float32
)
prg
=
fixtures
.
with_root_kernel
(
fixtures
.
get_weno_program
(),
"
mult_mat_vec
"
)
prg
(
queue
,
a
=
a
,
b
=
b
,
c
=
c_dev
,
alpha
=
alpha
)
return
c_dev
.
get
()
This diff is collapsed.
Click to expand it.
test.py
+
4
−
2
View file @
340b78d8
...
...
@@ -17,17 +17,19 @@ from pyopencl.tools import ( # noqa
import
fixtures
import
comparison_fixtures
as
compare
import
setup_fixtures
as
setup
import
kernel_fixtures
as
kernel
def
test_matvec
(
ctx_factory
):
a
=
setup
.
random_array
(
10
,
10
)
b
=
setup
.
random_array
(
10
)
c
=
fixtures
.
mult_mat_vec
(
ctx_factory
,
a
=
a
,
b
=
b
,
alpha
=
1.0
)
c
=
kernel
.
mult_mat_vec
(
ctx_factory
,
a
=
a
,
b
=
b
,
alpha
=
1.0
)
compare
.
arrays
(
a
@b
,
c
)
#
@pytest.mark.skip("slow")
@pytest.mark.skip
(
"
slow
"
)
def
test_compute_flux_derivatives
(
ctx_factory
):
logging
.
basicConfig
(
level
=
"
INFO
"
)
...
...
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