Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loopy
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
Ben Sepanski
loopy
Commits
c05844ee
Commit
c05844ee
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix up FEM quadrature example.
parent
6d6de311
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
loopy/kernel.py
+2
-2
2 additions, 2 deletions
loopy/kernel.py
test/test_fem_assembly.py
+13
-12
13 additions, 12 deletions
test/test_fem_assembly.py
with
15 additions
and
14 deletions
loopy/kernel.py
+
2
−
2
View file @
c05844ee
...
...
@@ -1101,10 +1101,10 @@ class LoopKernel(Record):
loop_list
=
"
,
"
.
join
(
sorted
(
self
.
insn_inames
(
insn
)))
if
len
(
loop_list
)
>
loop_list_width
:
lines
.
append
(
"
[%s]
"
%
loop_list
)
lines
.
append
(
"
%s%s <- %s
...
# %s
"
%
(
lines
.
append
(
"
%s%s <- %s
# %s
"
%
(
(
loop_list_width
+
2
)
*
"
"
,
insn
.
assignee
,
insn
.
expression
,
insn
.
id
))
else
:
lines
.
append
(
"
[%s]%s%s <- %s
...
# %s
"
%
(
lines
.
append
(
"
[%s]%s%s <- %s
# %s
"
%
(
loop_list
,
"
"
*
(
loop_list_width
-
len
(
loop_list
)),
insn
.
assignee
,
insn
.
expression
,
insn
.
id
))
...
...
This diff is collapsed.
Click to expand it.
test/test_fem_assembly.py
+
13
−
12
View file @
c05844ee
...
...
@@ -18,7 +18,7 @@ def test_laplacian_stiffness(ctx_factory):
dim
=
2
Nq
=
40
# num. quadrature points
Nc
=
100
0
# num. cells
Nc
=
100
# num. cells
Nb
=
20
# num. basis functions
# K - run-time symbolic
...
...
@@ -52,7 +52,7 @@ def test_laplacian_stiffness(ctx_factory):
def
variant_1
(
knl
):
# no ILP across elements
knl
=
lp
.
split_dimension
(
knl
,
"
K
"
,
16
,
outer_tag
=
"
g.0
"
,
slabs
=
(
0
,
1
))
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.
0
"
,
"
j
"
:
"
l.
1
"
})
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.
1
"
,
"
j
"
:
"
l.
0
"
})
knl
=
lp
.
add_prefetch
(
knl
,
'
jacInv
'
,
[
"
jacInv_dim_0
"
,
"
jacInv_dim_1
"
,
"
K_inner
"
,
"
q
"
])
return
knl
...
...
@@ -61,32 +61,33 @@ def test_laplacian_stiffness(ctx_factory):
# with ILP across elements
knl
=
lp
.
split_dimension
(
knl
,
"
K
"
,
16
,
outer_tag
=
"
g.0
"
,
slabs
=
(
0
,
1
))
knl
=
lp
.
split_dimension
(
knl
,
"
K_inner
"
,
4
,
inner_tag
=
"
ilp
"
)
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.
0
"
,
"
j
"
:
"
l.
1
"
})
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.
1
"
,
"
j
"
:
"
l.
0
"
})
knl
=
lp
.
add_prefetch
(
knl
,
"
jacInv
"
,
[
"
jacInv_dim_0
"
,
"
jacInv_dim_1
"
,
"
K_inner_inner
"
,
"
K_inner_outer
"
,
"
q
"
])
return
knl
def
variant_3
(
knl
):
# no ILP across elements, precompute dPsiTransf
# generates correct code--but suboptimal in a few ways.
knl
=
lp
.
split_dimension
(
knl
,
"
K
"
,
16
,
outer_tag
=
"
g.0
"
,
slabs
=
(
0
,
1
))
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.0
"
,
"
j
"
:
"
l.1
"
})
knl
=
lp
.
precompute
(
knl
,
"
dPsi
"
,
np
.
float32
,
sweep_axes
=
[
"
K_inner
"
])
knl
=
lp
.
add_prefetch
(
knl
,
"
jacInv
"
,
[
"
jacInv_dim_0
"
,
"
jacInv_dim_1
"
,
"
K_inner
"
,
"
q
"
])
print
lp
.
preprocess_kernel
(
knl
)
1
/
0
[
"
jacInv_dim_0
"
,
"
jacInv_dim_1
"
,
"
q
"
])
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
i
"
:
"
l.1
"
,
"
j
"
:
"
l.0
"
})
knl
=
lp
.
precompute
(
knl
,
"
dPsi
"
,
np
.
float32
,
sweep_axes
=
[
"
K_inner
"
],
default_tag
=
None
)
return
knl
#
for variant in [variant_1, variant_2, variant_3]:
for
variant
in
[
variant_3
]:
for
variant
in
[
variant_1
,
variant_2
,
variant_3
]:
#
for variant in [variant_3]:
kernel_gen
=
lp
.
generate_loop_schedules
(
variant
(
knl
),
loop_priority
=
[
"
jacInv_dim_0
"
,
"
jacInv_dim_1
"
])
kernel_gen
=
lp
.
check_kernels
(
kernel_gen
,
dict
(
Nc
=
Nc
))
lp
.
auto_test_vs_ref
(
seq_knl
,
ctx
,
kernel_gen
,
op_count
=
0
,
op_label
=
"
GFlops
"
,
parameters
=
{
"
Nc
"
:
Nc
},
print_
seq
_code
=
True
,
parameters
=
{
"
Nc
"
:
Nc
},
print_
ref
_code
=
True
,
timing_rounds
=
30
)
...
...
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