Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
pyopencl
Commits
71935d8c
Commit
71935d8c
authored
10 years ago
by
Yichao Yu
Browse files
Options
Downloads
Patches
Plain Diff
get_int_info
parent
ce7a7b68
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/c_wrapper/utils.h
+30
-0
30 additions, 0 deletions
src/c_wrapper/utils.h
src/c_wrapper/wrap_cl.cpp
+334
-361
334 additions, 361 deletions
src/c_wrapper/wrap_cl.cpp
with
364 additions
and
361 deletions
src/c_wrapper/utils.h
+
30
−
0
View file @
71935d8c
...
...
@@ -84,6 +84,14 @@ public:
namespace
pyopencl
{
template
<
typename
T
>
static
inline
cl_bool
cast_bool
(
const
T
&
v
)
{
return
v
?
CL_TRUE
:
CL_FALSE
;
}
// FIXME
static
inline
char
*
_copy_str
(
const
std
::
string
&
str
)
...
...
@@ -91,6 +99,8 @@ _copy_str(const std::string& str)
return
strdup
(
str
.
c_str
());
}
// {{{ GetInfo helpers
template
<
typename
T
,
typename
...
ArgTypes
,
typename
...
ArgTypes2
>
static
inline
pyopencl_buf
<
T
>
get_vec_info
(
cl_int
(
*
func
)(
ArgTypes
...),
const
char
*
name
,
...
...
@@ -201,4 +211,24 @@ get_str_info(cl_int (*func)(ArgTypes...), const char *name,
#define pyopencl_get_str_info(what, args...) \
pyopencl::get_str_info(clGet##what##Info, "clGet" #what "Info", args)
template
<
typename
T
,
typename
...
ArgTypes
,
typename
...
ArgTypes2
>
static
inline
generic_info
get_int_info
(
cl_int
(
*
func
)(
ArgTypes
...),
const
char
*
name
,
const
char
*
tpname
,
ArgTypes2
&&
...
args
)
{
pyopencl_buf
<
T
>
param_value
;
call_guarded
(
func
,
name
,
args
...,
sizeof
(
T
),
param_value
.
get
(),
NULL
);
generic_info
info
;
info
.
dontfree
=
0
;
info
.
opaque_class
=
CLASS_NONE
;
info
.
type
=
tpname
;
info
.
value
=
(
void
*
)
param_value
.
release
();
return
info
;
}
#define pyopencl_get_int_info(type, what, args...) \
pyopencl::get_int_info<type>(clGet##what##Info, "clGet" #what "Info", \
#type "*", args)
// }}}
}
This diff is collapsed.
Click to expand it.
src/c_wrapper/wrap_cl.cpp
+
334
−
361
View file @
71935d8c
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