<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic check context property in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933968#M1647</link>
    <description>&lt;P&gt;Hi forum,&lt;/P&gt;
&lt;P&gt;I have created an opencl context with the gl-cl interoperability. The context creation was fine and it did not give me any cl error string . But i am getting some trouble while making opencl image buffer from 2D gl texture object. I am getting the cl error string "CL_OUT_OF_RESOURCES"&lt;/P&gt;
&lt;P&gt;I suspect that i have problem with context creation. Since i am not getting any cl error string other than CL_SUCCESS, i do not know how else to validate the successful opencl context creation with gl-cl interoperability.&lt;/P&gt;
&lt;P&gt;To find the context info i am doing the following :&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;//now pull out the context infor from the recently created context&lt;/P&gt;
&lt;P&gt;size_t contextPropertySize = 0; cl_context_properties *properties = NULL;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//now extract the context information that we have created&lt;/P&gt;
&lt;P&gt;errNum = clGetContextInfo(_m_clContext,CL_CONTEXT_PROPERTIES,0,NULL,&amp;amp;contextPropertySize);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(errNum != CL_SUCCESS) { osg::notify(osg::FATAL) &amp;lt;&amp;lt; __FUNCTION__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; "Error while clGetContextInfo(..)" &amp;lt;&amp;lt; getErrorString(errNum) &amp;lt;&amp;lt; std::endl; } &lt;BR /&gt; properties = new cl_context_properties[contextPropertySize]; &lt;BR /&gt; errNum = clGetContextInfo(_m_clContext,CL_CONTEXT_PROPERTIES,contextPropertySize,properties,NULL); &lt;BR /&gt; if(errNum != CL_SUCCESS) { osg::notify(osg::FATAL) &amp;lt;&amp;lt; __FUNCTION__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; "Error while clGetContextInfo(..)" &amp;lt;&amp;lt; getErrorString(errNum) &amp;lt;&amp;lt; std::endl; }&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;So i have all the information inside properties array . How do i confirm that content of the properties array contain the context properties for gl-cl interoperability ?&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Sajjadul&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2013 22:34:26 GMT</pubDate>
    <dc:creator>Sajjadul</dc:creator>
    <dc:date>2013-09-19T22:34:26Z</dc:date>
    <item>
      <title>check context property</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933968#M1647</link>
      <description>&lt;P&gt;Hi forum,&lt;/P&gt;
&lt;P&gt;I have created an opencl context with the gl-cl interoperability. The context creation was fine and it did not give me any cl error string . But i am getting some trouble while making opencl image buffer from 2D gl texture object. I am getting the cl error string "CL_OUT_OF_RESOURCES"&lt;/P&gt;
&lt;P&gt;I suspect that i have problem with context creation. Since i am not getting any cl error string other than CL_SUCCESS, i do not know how else to validate the successful opencl context creation with gl-cl interoperability.&lt;/P&gt;
&lt;P&gt;To find the context info i am doing the following :&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;//now pull out the context infor from the recently created context&lt;/P&gt;
&lt;P&gt;size_t contextPropertySize = 0; cl_context_properties *properties = NULL;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//now extract the context information that we have created&lt;/P&gt;
&lt;P&gt;errNum = clGetContextInfo(_m_clContext,CL_CONTEXT_PROPERTIES,0,NULL,&amp;amp;contextPropertySize);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(errNum != CL_SUCCESS) { osg::notify(osg::FATAL) &amp;lt;&amp;lt; __FUNCTION__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; "Error while clGetContextInfo(..)" &amp;lt;&amp;lt; getErrorString(errNum) &amp;lt;&amp;lt; std::endl; } &lt;BR /&gt; properties = new cl_context_properties[contextPropertySize]; &lt;BR /&gt; errNum = clGetContextInfo(_m_clContext,CL_CONTEXT_PROPERTIES,contextPropertySize,properties,NULL); &lt;BR /&gt; if(errNum != CL_SUCCESS) { osg::notify(osg::FATAL) &amp;lt;&amp;lt; __FUNCTION__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; "Error while clGetContextInfo(..)" &amp;lt;&amp;lt; getErrorString(errNum) &amp;lt;&amp;lt; std::endl; }&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;So i have all the information inside properties array . How do i confirm that content of the properties array contain the context properties for gl-cl interoperability ?&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Sajjadul&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2013 22:34:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933968#M1647</guid>
      <dc:creator>Sajjadul</dc:creator>
      <dc:date>2013-09-19T22:34:26Z</dc:date>
    </item>
    <item>
      <title>How are you creating the</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933969#M1648</link>
      <description>&lt;P&gt;How are you creating the context? Your snippet shows code querrying the context but not the creation. You should create the context by setting the properties to enable CL/GL sharing. Also make sure to get the gl device associated with the gl context&lt;/P&gt;
&lt;P&gt;&amp;nbsp;[cpp]&lt;/P&gt;
&lt;P&gt;cl_context_properties properties[] =&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CL_CONTEXT_PLATFORM, (cl_context_properties) platform,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CL_GL_CONTEXT_KHR, (cl_context_properties) g_hRC,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CL_WGL_HDC_KHR, (cl_context_properties) g_hDC,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;....&lt;BR /&gt;cl_int res = pclGetGLContextInfoKHR(properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR, 0, NULL, &amp;amp;devSize);&lt;BR /&gt;res = pclGetGLContextInfoKHR( properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR, sizeof(cl_device_id), &amp;amp;device, NULL);&lt;BR /&gt;&lt;BR /&gt;.....&lt;BR /&gt;context = clCreateContext(properties,1,&amp;amp;device,0,0,&amp;amp;res);&lt;BR /&gt;&lt;BR /&gt;[/cpp]&lt;BR /&gt;&lt;BR /&gt;Of course, you should do the proper error checking at each step.&lt;BR /&gt;&lt;BR /&gt;Raghu&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2013 21:52:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933969#M1648</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2013-09-20T21:52:29Z</dc:date>
    </item>
    <item>
      <title>Thanks for the hint!</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933970#M1649</link>
      <description>&lt;P&gt;Thanks for the hint!&lt;/P&gt;
&lt;P&gt;I saw many examples where they have not used the function "clGetGLContextInfoKHR(...)" and their context creation is successful. I am confused if it mandatory to use it or not. I am creating the context as follows:&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;&lt;!--StartFragment--&gt; cl_context_properties contextProperties[] = { #ifdef defined(_WIN32) CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform, CL_GL_CONTEXT_KHR, (cl_context_properties) windowsContext-&amp;gt;getWGLContext(), CL_WGL_HDC_KHR, (cl_context_properties) windowsContext-&amp;gt;getHDC(), #elif defined(__GNUC__) CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform, CL_GL_CONTEXT_KHR, (cl_context_properties) linuxContext-&amp;gt;getContext(), CL_GLX_DISPLAY_KHR, (cl_context_properties) linuxContext-&amp;gt;getDisplay(), #elif defined(__APPLE__) CGLContextObj glContext = CGLGetCurrentContext(); // get the current GL context CGLShareGroupObj shareGroup = CGLGetShareGroup(glContext); // share group &lt;BR /&gt; CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties) shareGroup, #endif 0 }; &lt;BR /&gt; _m_clContext = clCreateContext(contextProperties,1,&amp;amp;clDevices[clDevUsed],NULL,NULL,&amp;amp;errNum); &lt;BR /&gt; if(errNum != CL_SUCCESS) { osg::notify(osg::FATAL) &amp;lt;&amp;lt; __FUNCTION__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; __LINE__ &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; " OpenCL Context Creation with GL-CL interoperability was not successful :" &amp;lt;&amp;lt; getErrorString(errNum) &amp;lt;&amp;lt; std::endl; return false; }&lt;!--EndFragment--&gt;&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;I am getting CL_SUCCESS &amp;nbsp;with the context creation. But later if i try to create 2D opencl image buffer from the valid opengl texture object i get the opencl error "CL_OUT_OF_RESOURCES". &amp;nbsp;Any idea what might have caused it ?&lt;/P&gt;
&lt;P&gt;It will be nice to know some scenarios that cause this type of error.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Sajjadul&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2013 11:48:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933970#M1649</guid>
      <dc:creator>Sajjadul</dc:creator>
      <dc:date>2013-09-21T11:48:39Z</dc:date>
    </item>
    <item>
      <title>You get CL_OUT_OF_RESOURCES</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933971#M1650</link>
      <description>&lt;P&gt;You get CL_OUT_OF_RESOURCES if for some reason the allocation failed (sorry dont have specifics). But I think the reason your call is failing is because you are creating a shared buffer without a shared context. You need to create the context using a device that is associated with both cl and gl.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Raghu&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2013 18:19:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/check-context-property/m-p/933971#M1650</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2013-10-07T18:19:08Z</dc:date>
    </item>
  </channel>
</rss>

