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
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
loopy
Commits
0f2a2519
Commit
0f2a2519
authored
9 years ago
by
James Stevens
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
c0dcf557
a9951731
No related branches found
No related tags found
1 merge request
!18
Merge updated statistics functions, tests, documentation, and tutorial sections
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/python/sparse.py
+14
-0
14 additions, 0 deletions
examples/python/sparse.py
loopy/kernel/creation.py
+20
-6
20 additions, 6 deletions
loopy/kernel/creation.py
with
34 additions
and
6 deletions
examples/python/sparse.py
0 → 100644
+
14
−
0
View file @
0f2a2519
import
loopy
as
lp
k
=
lp
.
make_kernel
([
"
[m] -> { [i] : 0 <= i < m }
"
,
"
[length] -> { [j] : 0 <= j < length }
"
],
"""
rowstart = rowstarts[i]
rowend = rowstarts[1 + i]
length = rowend + (-1)*rowstart
rowsum = 0 {id=zerosum}
rowsum = rowsum + x[-1 + colindices[-1 + rowstart + j]]*values[-1 + rowstart + j] {dep=zerosum}
y[i] = rowsum
"""
)
print
(
k
)
This diff is collapsed.
Click to expand it.
loopy/kernel/creation.py
+
20
−
6
View file @
0f2a2519
...
...
@@ -914,13 +914,27 @@ def guess_arg_shape_if_requested(kernel, default_order):
if
armap
.
access_range
is
None
:
if
armap
.
bad_subscripts
:
raise
RuntimeError
(
"
cannot determine access range for
'
%s
'
:
"
"
undetermined index in subscript(s)
'
%s
'"
%
(
arg
.
name
,
"
,
"
.
join
(
str
(
i
)
for
i
in
armap
.
bad_subscripts
)))
n_axes_in_subscripts
=
set
(
len
(
sub
.
index_tuple
)
for
sub
in
armap
.
bad_subscripts
)
# no subscripts found, let's call it a scalar
shape
=
()
if
len
(
n_axes_in_subscripts
)
!=
1
:
raise
RuntimeError
(
"
subscripts of
'
%s
'
with differing
"
"
numbers of axes were found
"
%
arg
.
name
)
n_axes
,
=
n_axes_in_subscripts
if
n_axes
==
1
:
# Leave shape undetermined--we can live with that for 1D.
shape
=
(
None
,)
else
:
raise
RuntimeError
(
"
cannot determine access range for
'
%s
'
:
"
"
undetermined index in subscript(s)
'
%s
'"
%
(
arg
.
name
,
"
,
"
.
join
(
str
(
i
)
for
i
in
armap
.
bad_subscripts
)))
else
:
# no subscripts found, let's call it a scalar
shape
=
()
else
:
from
loopy.isl_helpers
import
static_max_of_pw_aff
from
loopy.symbolic
import
pw_aff_to_expr
...
...
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