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
d35842be
Commit
d35842be
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
print_highlighted_code -> get_highlighted_code.
parent
8f4f32cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/compiled.py
+9
-6
9 additions, 6 deletions
loopy/compiled.py
with
9 additions
and
6 deletions
loopy/compiled.py
+
9
−
6
View file @
d35842be
...
@@ -203,22 +203,25 @@ class CompiledKernel:
...
@@ -203,22 +203,25 @@ class CompiledKernel:
return
evt
,
outputs
return
evt
,
outputs
def
print_code
(
self
):
print
get_highlighted_code
(
self
.
code
)
# }}}
# }}}
def
prin
t_highlighted_code
(
text
):
def
ge
t_highlighted_code
(
text
):
try
:
try
:
from
pygments
import
highlight
from
pygments
import
highlight
except
ImportError
:
except
ImportError
:
print
text
return
text
else
:
else
:
from
pygments.lexers
import
CLexer
from
pygments.lexers
import
CLexer
from
pygments.formatters
import
TerminalFormatter
from
pygments.formatters
import
TerminalFormatter
print
highlight
(
text
,
CLexer
(),
TerminalFormatter
())
return
highlight
(
text
,
CLexer
(),
TerminalFormatter
())
...
@@ -257,7 +260,7 @@ def drive_timing_run(kernel_generator, queue, launch, flop_count=None,
...
@@ -257,7 +260,7 @@ def drive_timing_run(kernel_generator, queue, launch, flop_count=None,
print
"
SOLUTION #%d
"
%
soln_count
print
"
SOLUTION #%d
"
%
soln_count
print
"
-----------------------------------------------
"
print
"
-----------------------------------------------
"
if
print_code
:
if
print_code
:
print_highlighted_code
(
compiled
.
code
)
print
get
_highlighted_code
(
compiled
.
code
)
print
"
-----------------------------------------------
"
print
"
-----------------------------------------------
"
elapsed
=
time_run
(
compiled
)
elapsed
=
time_run
(
compiled
)
...
@@ -497,7 +500,7 @@ def auto_test_vs_ref(ref_knl, ctx, kernel_gen, op_count=[], op_label=[], paramet
...
@@ -497,7 +500,7 @@ def auto_test_vs_ref(ref_knl, ctx, kernel_gen, op_count=[], op_label=[], paramet
print
75
*
"
-
"
print
75
*
"
-
"
print
"
Reference Code:
"
print
"
Reference Code:
"
print
75
*
"
-
"
print
75
*
"
-
"
print_highlighted_code
(
ref_compiled
.
code
)
print
get
_highlighted_code
(
ref_compiled
.
code
)
print
75
*
"
-
"
print
75
*
"
-
"
ref_args
,
ref_input_arrays
,
ref_output_arrays
=
\
ref_args
,
ref_input_arrays
,
ref_output_arrays
=
\
...
@@ -543,7 +546,7 @@ def auto_test_vs_ref(ref_knl, ctx, kernel_gen, op_count=[], op_label=[], paramet
...
@@ -543,7 +546,7 @@ def auto_test_vs_ref(ref_knl, ctx, kernel_gen, op_count=[], op_label=[], paramet
print
"
Kernel #%d:
"
%
i
print
"
Kernel #%d:
"
%
i
print
75
*
"
-
"
print
75
*
"
-
"
if
print_code
:
if
print_code
:
print_highlighted_code
(
compiled
.
code
)
print
get
_highlighted_code
(
compiled
.
code
)
print
75
*
"
-
"
print
75
*
"
-
"
if
dump_binary
:
if
dump_binary
:
print
type
(
compiled
.
cl_program
)
print
type
(
compiled
.
cl_program
)
...
...
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