Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francesco Brarda
stan-math-petsc
Commits
e5de8111
Commit
e5de8111
authored
7 years ago
by
rok-cesnovar
Browse files
Options
Download
Email Patches
Plain Diff
macros test
parent
1e5f13e3
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
stan/math/gpu/kernel_cl.hpp
+4
-0
stan/math/gpu/kernel_cl.hpp
stan/math/gpu/kernels/add_matrix_kernel.cl
+1
-10
stan/math/gpu/kernels/add_matrix_kernel.cl
with
5 additions
and
10 deletions
+5
-10
stan/math/gpu/kernel_cl.hpp
View file @
e5de8111
...
...
@@ -139,6 +139,10 @@ class kernel_cl {
+
std
::
to_string
(
this
->
base_options
()[
comp_opts
]);
}
}
kernel_opts
+=
std
::
string
(
" -DA(i,j)=A[j*rows+i]"
);
kernel_opts
+=
std
::
string
(
" -DB(i,j)=B[j*rows+i]"
);
kernel_opts
+=
std
::
string
(
" -DC(i,j)=C[j*rows+i]"
);
try
{
cl
::
Program
::
Sources
source
(
1
,
...
...
This diff is collapsed.
Click to expand it.
stan/math/gpu/kernels/add_matrix_kernel.cl
View file @
e5de8111
#
define
STRINGIFY
(
src
)
#
src
STRINGIFY
(
//#ifndef
A
//#define
A
(
i,
j
)
A[j
*
rows
+
i]
//#endif
//#ifndef
B
//#define
B
(
i,
j
)
B[j
*
rows
+
i]
//#endif
//#ifndef
C
//#define
C
(
i,
j
)
C[j
*
rows
+
i]
//#endif
/**
*
Matrix
addition
on
the
GPU
*
...
...
@@ -25,7 +16,7 @@ __kernel void add(__global double *C, __global double *A, __global double *B,
int
i
=
get_global_id
(
0
)
;
int
j
=
get_global_id
(
1
)
;
if
(
i
<
rows
&&
j
<
cols
)
{
C
[j
*
rows
+
i]
=
A[j
*
rows
+
i]
+
B[j
*
rows
+
i]
;
C
(
i,
j
)
=
A
(
i,
j
)
+
B
(
i,
j
)
;
}
}
)
;
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help