Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pystencils-benchmark
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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-benchmark
Commits
82ce1d7d
Commit
82ce1d7d
authored
1 year ago
by
Christoph Alt
Browse files
Options
Downloads
Patches
Plain Diff
Fix the missing constants for the gpu main file and added a kernel with
a constant to the gpu tests
parent
6e88d389
No related branches found
No related tags found
1 merge request
!1
Add CUDA support
Pipeline
#55139
skipped
Stage: docker-build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pystencils_benchmark/templates/gpu/main.c
+6
-0
6 additions, 0 deletions
pystencils_benchmark/templates/gpu/main.c
tests/test_benchmark.py
+7
-1
7 additions, 1 deletion
tests/test_benchmark.py
with
13 additions
and
1 deletion
pystencils_benchmark/templates/gpu/main.c
+
6
−
0
View file @
82ce1d7d
...
@@ -32,6 +32,12 @@ int main(int argc, char **argv)
...
@@ -32,6 +32,12 @@ int main(int argc, char **argv)
cudaMemset
({{
field_name
}},
0
.
23
,
{{
elements
}});
cudaMemset
({{
field_name
}},
0
.
23
,
{{
elements
}});
{
%
endfor
%
}
{
%
endfor
%
}
{
%
for
constantName
,
dataType
in
kernel
.
constants
%
}
// Constant {{constantName}}
{{
dataType
}}
{{
constantName
}};
{{
constantName
}}
=
0
.
23
;
{
%
endfor
%
}
dim3
blocks
({{
kernel
.
blocks
[
0
]}},
{{
kernel
.
blocks
[
1
]}},
{{
kernel
.
blocks
[
2
]}});
dim3
blocks
({{
kernel
.
blocks
[
0
]}},
{{
kernel
.
blocks
[
1
]}},
{{
kernel
.
blocks
[
2
]}});
dim3
grid
({{
kernel
.
grid
[
0
]}},
{{
kernel
.
grid
[
1
]}},
{{
kernel
.
grid
[
2
]}});
dim3
grid
({{
kernel
.
grid
[
0
]}},
{{
kernel
.
grid
[
1
]}},
{{
kernel
.
grid
[
2
]}});
...
...
This diff is collapsed.
Click to expand it.
tests/test_benchmark.py
+
7
−
1
View file @
82ce1d7d
...
@@ -48,14 +48,20 @@ gpu_kwargs = ({}, {'launch_bounds': (256,)}, {'launch_bounds': (256, 2)})
...
@@ -48,14 +48,20 @@ gpu_kwargs = ({}, {'launch_bounds': (256,)}, {'launch_bounds': (256, 2)})
def
test_generate_gpu
(
kwargs
):
def
test_generate_gpu
(
kwargs
):
compiler
=
Compiler
.
NVCC
compiler
=
Compiler
.
NVCC
a
,
b
,
c
=
ps
.
fields
(
a
=
np
.
ones
(
4000000
),
b
=
np
.
ones
(
4000000
),
c
=
np
.
ones
(
4000000
))
a
,
b
,
c
=
ps
.
fields
(
a
=
np
.
ones
(
4000000
),
b
=
np
.
ones
(
4000000
),
c
=
np
.
ones
(
4000000
))
alpha
=
sp
.
symbols
(
'
alpha
'
)
@ps.kernel_config
(
ps
.
CreateKernelConfig
(
target
=
ps
.
Target
.
GPU
))
@ps.kernel_config
(
ps
.
CreateKernelConfig
(
target
=
ps
.
Target
.
GPU
))
def
vadd
():
def
vadd
():
a
[
0
]
@=
b
[
0
]
+
c
[
0
]
a
[
0
]
@=
b
[
0
]
+
c
[
0
]
kernel_vadd
=
ps
.
create_kernel
(
**
vadd
)
kernel_vadd
=
ps
.
create_kernel
(
**
vadd
)
@ps.kernel_config
(
ps
.
CreateKernelConfig
(
target
=
ps
.
Target
.
GPU
))
def
daxpy
():
b
[
0
]
@=
alpha
*
a
[
0
]
+
b
[
0
]
kernel_daxpy
=
ps
.
create_kernel
(
**
daxpy
)
with
tempfile
.
TemporaryDirectory
(
dir
=
Path
.
cwd
())
as
temp_dir
:
with
tempfile
.
TemporaryDirectory
(
dir
=
Path
.
cwd
())
as
temp_dir
:
temp_dir
=
Path
(
temp_dir
)
temp_dir
=
Path
(
temp_dir
)
pb
.
gpu
.
generate_benchmark
(
kernel_vadd
,
temp_dir
,
compiler
=
compiler
,
**
kwargs
)
pb
.
gpu
.
generate_benchmark
(
[
kernel_vadd
,
kernel_daxpy
],
temp_dir
,
compiler
=
compiler
,
**
kwargs
)
subprocess
.
run
([
'
make
'
,
'
-C
'
,
f
'
{
temp_dir
}
'
],
check
=
True
)
subprocess
.
run
([
'
make
'
,
'
-C
'
,
f
'
{
temp_dir
}
'
],
check
=
True
)
subprocess
.
run
([
f
'
{
temp_dir
}
/benchmark-
{
compiler
.
name
}
'
,
'
10
'
],
check
=
True
)
subprocess
.
run
([
f
'
{
temp_dir
}
/benchmark-
{
compiler
.
name
}
'
,
'
10
'
],
check
=
True
)
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