- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hey
I have a error when I write the static variable in kernel function. Here is a simple example. " void funA() { static int b = 0; } void kernel fun(__global int *a) { funA(); } " Don't I use the "static" in opencl kernel ? regards.,Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My question is why the static variable is required?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The OpenCL language specification does not allow static variables. See Section 6.8.f "The extern, static, auto and register storage-class specifiers are notsupported."
--- Quote Start --- hey I have a error when I write the static variable in kernel function. Here is a simple example. " void funA() { static int b = 0; } void kernel fun(__global int *a) { funA(); } " Don't I use the "static" in opencl kernel ? regards., --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can however define constant data at file scope:
__constant int b = 0;
void funA()
{
// Access b here
}
void kernel fun(__global int *a)
{
funA();
}

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page