Hi forum,
I am creating an OpenCL texture in the usual manner:
clCreateFromGLTexture2D() and i am getting the error mentioned in the subject. I am not sure here what might have went wrong:
1. I have the valid opencl context.
2. memory flag is both read and write.
3. a valid texture target is mentioned.
4. miplevel value is set to 0
5. a texture id is set.
Any hint to get around this issue? Is there any generic scenarios that causes this type of error?
Thanks
Sajjadul
Lets make it more specific . Where to look into if you have this type of error . The specification only says that :
"CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device."
When do we have this type of failure as we try to extract opencl buffer from opengl texture object?
Thanks
Sajjadul
Hi I suspect that the error is coming while creating context itself. How you are saying that you are having valid context, have you tried to print its value?. if not try doing it.
Hi
I think the context creation is fine. I checked with the condition if(errNum != CL_SUCCESS) and i did not get any error while opencl context creation with opengl opencl context properties for opengl-opencl interoperability.
I am getting the OUT_OF_RESOURCES error when i try to write to the buffer . Lets put more code snippet to explain the issue i am going with:
I am pulling the OpenCL memory from the OpenGL object as follows:
memory._m_clGraphicsArrayBuffer = clCreateFromGLTexture2D(...);
when i check if the buffer is successfully created or not i get the error OUT_OF_RESOURCES. Now comes the kernel function :
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_TRUE | CLK_FILTER_LINEAR;
_kernel void swapKernel(__read_only image2d_t srcArray,
__global float4* trgBuffer,
__read_only unsigned int pitch )
{
//get the width and height of the source image
int width = get_image_width(srcArray);
int height = get_image_height(srcArray);
int2 coord = (int2)(get_global_id(0),get_global_id(1));
if( coord.x < width && coord.y < height)
{
float offset_X = (1.0/(float)width) * 0.5f;
float offset_Y = (1.0/(float)height) * 0.5f;
//compute the texture coordinated
float2 texCoord = (float2) ( ((float) coord.x / (float) width) + offset_X,
((float) coord.y / (float) height) + offset_Y );
//sample value
float4 src = read_imagef(srcArray,sampler, coord);
//swap the channels and store the color value
float4 color = (float4)(src.z, src.x, src.y, drc,w);
//compute the target address
float4 *target = (float4*) (((char*) trgBuffer ) + pitch * coord.y ) + coord.x ;
// GETTING OUT_OF_RESOURCES WITH THE FOLLOWING STATEMENT
(*target) = color;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
It is quite a while i am stuck with this issue. Some hint is really appreciated !
Thanks
Sajjadul
I tried compiling your kernel and had to make the following changes:
What is CLK_ADDRESS_TRUE?
replaced it with CLK_ADDRESS_CLAMP_TO_EDGE
replaced _kernel with kernel
replaced drc,w with src.w
computed target address without casting and added the global qualifier as in:
global float4* target = trgBuffer + pitch * coord.y + coord.x;
Now your kernel compiles with two warnings. I'm curious, how do you know that the last line of your kernel is causing the CL_OUT_OF_RESOURCES error?
Sorry for the typos . They are ok in the actual kernel.
If i comment (*target) = color , i do not get the CL_OUT_OF_RESOURCES error.
What are the two warnings are you getting ?
And any reason that you added the global qualifier ?
I tried with your hints and still i am getting the same error . Any more thoughts ?
Thanks
Sajjadul
I tried compiling your kernel..Its fine with me.. but you are getting this while running your application it seems. To test to that level i need complete sample code.
Yes, i am getting this while running the application. The full sample code is quite large. It is a part of the on-going library api plugin and i am trying to extend it with OpenCL.
Now i am attaching the application side of the code snippet here where i am having the information mentioning that it was unsuccessful to pull out the opencl 2D image object from the opengl object:
(Most of the snippet belong to the OpenSceneGraph though)
////////////////////////////////////////////////////////////////////////////////////
........
........
if(memory._m_clGraphicsArrayBuffer != 0) // handle to the opencl buffer pulled out from the opengl object
{
return true;
}
osg::Texture::TextureObject *tex = _texref->getTextureObject(osgCompute::GLMemory::getContext()->getState()->getContextID());
if(!tex)
{
osg::State *state = osgCompute::GLMemory::getContext()->getState();
if(state == NULL)
{
return false;
}
_texref->compileGLObjects(*state);
glBindTexture(_texref->getTextureTarget(),0);
tex = _texref->getTextureObject(osgCompute::GLMemory::getContext()->getState()->getContextID());
}
GLenum texture_target = tex->_profile._target;
if(texture_target == GL_TEXTURE_2D || texture_target == GL_TEXTURE_RECTANGLE)
{
(memory._m_clGraphicsArrayBuffer) = clCreateFromGLTexture2D(cxt->_m_clContext,
CL_MEM_READ_WRITE,
texture_target,
0,
tex->id(),
&errNum);
if( errNum != CL_SUCCESS )
{
//I GET THE ERROR INFORMATION THAT IT WAS UNSUCCESSFUL TO PULL OUT THE OPENCL BUFFER
}
}
////////////////////////////////////////////////////////////////////////////////////
I think i manage to give a picture to this.
Let me know.
Thanks
Sajjadul
Hi Sajis,
Are you saying that you are getting that error from the kernel and not from some OpenCL host-side API?
If so, i would request you to create a small test-case to reproduce this issue. Thanks.
Hi Himanshu
I am getting the error information from the OpenCL host api side function call as follows:
memory._m_clGraphicsArrayBuffer = clCreateFromGLTexture2D(....);
When i check if the above statements has executed successfully as follows:
if(errNum != CL_SUCCESS)
{
// I PRINT OUT THE FAILURE
}
errNum is returning failure.
Let me know if you any more info to help tracking the problem.
Thanks
Sajjadul
Hi,
Did you take a look at my earlier post below? Can you confirm if you are satisfying all the conditions required for clCreateFromGLTexture2D to succeed?
Thanks,
Bruhaspati
Check the Khronos link above.
To use GL_TEXTURE_RECTANGLE -- You should be OpenGL 3.1
More precisely, here is the snippet for your convenience..
Does your OpenGL texture satisfy the conditions below?
texture_target
Must be one of GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_RECTANGLE. texture_target
is used only to define the image type of texture
. No reference to a bound GL texture object is made or implied by this parameter.
Using GL_TEXTURE_RECTANGLE for texture_target requires OpenGL 3.1. Alternatively, GL_TEXTURE_RECTANGLE_ARB may be specified if the OpenGL extension GL_ARB_texture_rectangle is supported.
- Bruhaspati
Hi Himanshu,
himanshu.gautam wrote:
Check the Khronos link above.
To use GL_TEXTURE_RECTANGLE -- You should be OpenGL 3.1
More precisely, here is the snippet for your convenience..
Does your OpenGL texture satisfy the conditions below?
texture_target
Must be one of GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_RECTANGLE.
texture_target
is used only to define the image type oftexture
. No reference to a bound GL texture object is made or implied by this parameter.Using GL_TEXTURE_RECTANGLE for texture_target requires OpenGL 3.1. Alternatively, GL_TEXTURE_RECTANGLE_ARB may be specified if the OpenGL extension GL_ARB_texture_rectangle is supported.
- Bruhaspati
I believe that it does . Here goes the snippet :
///////////////////////////////////////////////////////////////////////////////////////
//get the texture target
GLenum texture_target = tex->_profile._target;
//create buffer based on the texture target
if( texture_target == GL_TEXTURE_2D || texture_target == GL_TEXTURE_RECTANGLE_ARB )
{
if((cxt->_m_clContext) == 0)
{
osg::notify(osg::FATAL) << __FUNCTION__ << ": " << __LINE__ << ": " << _texref->getName()
<< ": NO VALID CONTEXT FOUND "
<< cxt->getErrorString(errNum) << std::endl;
return false;
}
(memory._m_clGraphicsArrayBuffer) = clCreateFromGLTexture2D(cxt->_m_clContext,
CL_MEM_READ_WRITE,
texture_target,
0,
tex->id(),
&errNum);
if(errNum != CL_SUCCESS)
{
osg::notify(osg::FATAL) << __FUNCTION__ << ": " << __LINE__ << ": " << _texref->getName()
<< ": unable to pull out the 2D OpenCL texture memory from the OpenGL memory: "
<< cxt->getErrorString(errNum) << std::endl;
return false;
}
//NEVER REACH HERE TO EXIT THE APPLICATION
exit(EXIT_FAILURE);
}
else if( texture_target == GL_TEXTURE_3D )
{
//creates the OpenCL 3D image from the OpenGL 3D texture object
memory._m_clGraphicsArrayBuffer = clCreateFromGLTexture3D(cxt->_m_clContext,
CL_MEM_READ_WRITE,
texture_target,
0,
tex->id(),
&errNum);
if(errNum != CL_SUCCESS)
{
osg::notify(osg::FATAL) << __FUNCTION__ << ": unable to pull out the 3D OpenCL texture memory from the OpenGL memory" << errNum << std::endl;
return false;
}
}
////////////////////////////////////////////////////////////////////////////////////////
I hope the pasted code is readable to you. What is the way to paste code here. "
" ....... "" seems not to work here.
Let's get back to the main issue. I am using the ARB extension here for GL_TEXTURE_RECTANGLE_ARB. I kind of agree with the reason of getting the CL_OUT_OF_RESOURCES. You have mentioned that i might be accessing the invalid address inside the kernel. I would like to know how to validate an address pointer.
Thanks
Sajjadul
Hi,
Can you provide output of "glinfo"?
Let us first see what all extensions are available....
I don't believe there is an issue with your pointer.
My name is Bruhaspati.....And this ID is polymorphic.
We take turns to support all of you.
- Bruhaspati
Hi ,
Here goes the output of the glxinfo :
//////////////////////////////////////////////////////////////////////////////
name of display:
display: screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_texture_from_pixmap, GLX_EXT_buffer_age, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_create_context_es2_profile, GLX_ARB_create_context_robustness,
GLX_ARB_multisample, GLX_NV_float_buffer, GLX_ARB_fbconfig_float,
GLX_EXT_framebuffer_sRGB, GLX_NV_multisample_coverage
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync,
GLX_NV_swap_group, GLX_NV_video_out, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGI_swap_control, GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_buffer_age, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_NV_float_buffer,
GLX_ARB_fbconfig_float, GLX_EXT_fbconfig_packed_float,
GLX_EXT_texture_from_pixmap, GLX_EXT_framebuffer_sRGB,
GLX_NV_present_video, GLX_NV_copy_image, GLX_NV_multisample_coverage,
GLX_NV_video_capture, GLX_EXT_create_context_es_profile,
GLX_EXT_create_context_es2_profile, GLX_ARB_create_context_robustness
GLX version: 1.4
GLX extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_swap_control, GLX_EXT_swap_control_tear,
GLX_EXT_texture_from_pixmap, GLX_EXT_buffer_age, GLX_ARB_create_context,
GLX_ARB_create_context_profile, GLX_EXT_create_context_es_profile,
GLX_EXT_create_context_es2_profile, GLX_ARB_create_context_robustness,
GLX_ARB_multisample, GLX_NV_float_buffer, GLX_ARB_fbconfig_float,
GLX_EXT_framebuffer_sRGB, GLX_NV_multisample_coverage,
GLX_ARB_get_proc_address
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 560M/PCIe/SSE2
OpenGL version string: 4.3.0 NVIDIA 319.60
OpenGL shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL extensions:
GL_AMD_multi_draw_indirect, GL_ARB_arrays_of_arrays, GL_ARB_base_instance,
GL_ARB_blend_func_extended, GL_ARB_clear_buffer_object,
GL_ARB_color_buffer_float, GL_ARB_compatibility,
GL_ARB_compressed_texture_pixel_storage, GL_ARB_conservative_depth,
GL_ARB_compute_shader, GL_ARB_copy_buffer, GL_ARB_copy_image,
GL_ARB_debug_output, GL_ARB_depth_buffer_float, GL_ARB_depth_clamp,
GL_ARB_depth_texture, GL_ARB_draw_buffers, GL_ARB_draw_buffers_blend,
GL_ARB_draw_indirect, GL_ARB_draw_elements_base_vertex,
GL_ARB_draw_instanced, GL_ARB_ES2_compatibility, GL_ARB_ES3_compatibility,
GL_ARB_explicit_attrib_location, GL_ARB_explicit_uniform_location,
GL_ARB_fragment_coord_conventions, GL_ARB_fragment_layer_viewport,
GL_ARB_fragment_program, GL_ARB_fragment_program_shadow,
GL_ARB_fragment_shader, GL_ARB_framebuffer_no_attachments,
GL_ARB_framebuffer_object, GL_ARB_framebuffer_sRGB,
GL_ARB_geometry_shader4, GL_ARB_get_program_binary, GL_ARB_gpu_shader5,
GL_ARB_gpu_shader_fp64, GL_ARB_half_float_pixel, GL_ARB_half_float_vertex,
GL_ARB_imaging, GL_ARB_instanced_arrays, GL_ARB_internalformat_query,
GL_ARB_internalformat_query2, GL_ARB_invalidate_subdata,
GL_ARB_map_buffer_alignment, GL_ARB_map_buffer_range,
GL_ARB_multi_draw_indirect, GL_ARB_multisample, GL_ARB_multitexture,
GL_ARB_occlusion_query, GL_ARB_occlusion_query2,
GL_ARB_pixel_buffer_object, GL_ARB_point_parameters, GL_ARB_point_sprite,
GL_ARB_program_interface_query, GL_ARB_provoking_vertex,
GL_ARB_robust_buffer_access_behavior, GL_ARB_robustness,
GL_ARB_sample_shading, GL_ARB_sampler_objects, GL_ARB_seamless_cube_map,
GL_ARB_separate_shader_objects, GL_ARB_shader_atomic_counters,
GL_ARB_shader_bit_encoding, GL_ARB_shader_image_load_store,
GL_ARB_shader_image_size, GL_ARB_shader_objects, GL_ARB_shader_precision,
GL_ARB_shader_storage_buffer_object, GL_ARB_shader_subroutine,
GL_ARB_shader_texture_lod, GL_ARB_shading_language_100,
GL_ARB_shading_language_420pack, GL_ARB_shading_language_include,
GL_ARB_shading_language_packing, GL_ARB_shadow, GL_ARB_stencil_texturing,
GL_ARB_sync, GL_ARB_tessellation_shader, GL_ARB_texture_border_clamp,
GL_ARB_texture_buffer_object, GL_ARB_texture_buffer_object_rgb32,
GL_ARB_texture_buffer_range, GL_ARB_texture_compression,
GL_ARB_texture_compression_bptc, GL_ARB_texture_compression_rgtc,
GL_ARB_texture_cube_map, GL_ARB_texture_cube_map_array,
GL_ARB_texture_env_add, GL_ARB_texture_env_combine,
GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3,
GL_ARB_texture_float, GL_ARB_texture_gather,
GL_ARB_texture_mirrored_repeat, GL_ARB_texture_multisample,
GL_ARB_texture_non_power_of_two, GL_ARB_texture_query_levels,
GL_ARB_texture_query_lod, GL_ARB_texture_rectangle, GL_ARB_texture_rg,
GL_ARB_texture_rgb10_a2ui, GL_ARB_texture_storage,
GL_ARB_texture_storage_multisample, GL_ARB_texture_swizzle,
GL_ARB_texture_view, GL_ARB_timer_query, GL_ARB_transform_feedback2,
GL_ARB_transform_feedback3, GL_ARB_transform_feedback_instanced,
GL_ARB_transpose_matrix, GL_ARB_uniform_buffer_object,
GL_ARB_vertex_array_bgra, GL_ARB_vertex_array_object,
GL_ARB_vertex_attrib_64bit, GL_ARB_vertex_attrib_binding,
GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_vertex_shader,
GL_ARB_vertex_type_2_10_10_10_rev, GL_ARB_viewport_array,
GL_ARB_window_pos, GL_ATI_draw_buffers, GL_ATI_texture_float,
GL_ATI_texture_mirror_once, GL_S3_s3tc, GL_EXT_texture_env_add,
GL_EXT_abgr, GL_EXT_bgra, GL_EXT_bindable_uniform, GL_EXT_blend_color,
GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array,
GL_EXT_Cg_shader, GL_EXT_depth_bounds_test, GL_EXT_direct_state_access,
GL_EXT_draw_buffers2, GL_EXT_draw_instanced, GL_EXT_draw_range_elements,
GL_EXT_fog_coord, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample,
GL_EXTX_framebuffer_mixed_formats,
GL_EXT_framebuffer_multisample_blit_scaled, GL_EXT_framebuffer_object,
GL_EXT_framebuffer_sRGB, GL_EXT_geometry_shader4,
GL_EXT_gpu_program_parameters, GL_EXT_gpu_shader4,
GL_EXT_multi_draw_arrays, GL_EXT_packed_depth_stencil,
GL_EXT_packed_float, GL_EXT_packed_pixels, GL_EXT_pixel_buffer_object,
GL_EXT_point_parameters, GL_EXT_provoking_vertex, GL_EXT_rescale_normal,
GL_EXT_secondary_color, GL_EXT_separate_shader_objects,
GL_EXT_separate_specular_color, GL_EXT_shader_image_load_store,
GL_EXT_shadow_funcs, GL_EXT_stencil_two_side, GL_EXT_stencil_wrap,
GL_EXT_texture3D, GL_EXT_texture_array, GL_EXT_texture_buffer_object,
GL_EXT_texture_compression_dxt1, GL_EXT_texture_compression_latc,
GL_EXT_texture_compression_rgtc, GL_EXT_texture_compression_s3tc,
GL_EXT_texture_cube_map, GL_EXT_texture_edge_clamp,
GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3,
GL_EXT_texture_filter_anisotropic, GL_EXT_texture_integer,
GL_EXT_texture_lod, GL_EXT_texture_lod_bias, GL_EXT_texture_mirror_clamp,
GL_EXT_texture_object, GL_EXT_texture_shared_exponent,
GL_EXT_texture_sRGB, GL_EXT_texture_sRGB_decode, GL_EXT_texture_storage,
GL_EXT_texture_swizzle, GL_EXT_timer_query, GL_EXT_transform_feedback2,
GL_EXT_vertex_array, GL_EXT_vertex_array_bgra, GL_EXT_vertex_attrib_64bit,
GL_EXT_x11_sync_object, GL_EXT_import_sync_object, GL_IBM_rasterpos_clip,
GL_IBM_texture_mirrored_repeat, GL_KHR_debug, GL_KTX_buffer_region,
GL_NV_blend_square, GL_NV_compute_program5, GL_NV_conditional_render,
GL_NV_copy_depth_to_color, GL_NV_copy_image, GL_NV_depth_buffer_float,
GL_NV_depth_clamp, GL_NV_draw_texture, GL_NV_ES1_1_compatibility,
GL_NV_explicit_multisample, GL_NV_fence, GL_NV_float_buffer,
GL_NV_fog_distance, GL_NV_fragment_program, GL_NV_fragment_program_option,
GL_NV_fragment_program2, GL_NV_framebuffer_multisample_coverage,
GL_NV_geometry_shader4, GL_NV_gpu_program4, GL_NV_gpu_program4_1,
GL_NV_gpu_program5, GL_NV_gpu_program5_mem_extended,
GL_NV_gpu_program_fp64, GL_NV_gpu_shader5, GL_NV_half_float,
GL_NV_light_max_exponent, GL_NV_multisample_coverage,
GL_NV_multisample_filter_hint, GL_NV_occlusion_query,
GL_NV_packed_depth_stencil, GL_NV_parameter_buffer_object,
GL_NV_parameter_buffer_object2, GL_NV_path_rendering,
GL_NV_pixel_data_range, GL_NV_point_sprite, GL_NV_primitive_restart,
GL_NV_register_combiners, GL_NV_register_combiners2,
GL_NV_shader_atomic_counters, GL_NV_shader_atomic_float,
GL_NV_shader_buffer_load, GL_NV_shader_storage_buffer_object,
GL_NV_texgen_reflection, GL_NV_texture_barrier,
GL_NV_texture_compression_vtc, GL_NV_texture_env_combine4,
GL_NV_texture_expand_normal, GL_NV_texture_multisample,
GL_NV_texture_rectangle, GL_NV_texture_shader, GL_NV_texture_shader2,
GL_NV_texture_shader3, GL_NV_transform_feedback,
GL_NV_transform_feedback2, GL_NV_vdpau_interop, GL_NV_vertex_array_range,
GL_NV_vertex_array_range2, GL_NV_vertex_attrib_integer_64bit,
GL_NV_vertex_buffer_unified_memory, GL_NV_vertex_program,
GL_NV_vertex_program1_1, GL_NV_vertex_program2,
GL_NV_vertex_program2_option, GL_NV_vertex_program3,
GL_NVX_conditional_render, GL_NVX_gpu_memory_info,
GL_SGIS_generate_mipmap, GL_SGIS_texture_lod, GL_SGIX_depth_texture,
GL_SGIX_shadow, GL_SUN_slice_accum
////////////////////////////////////////////////////////////////////////////
Initially i did not get any output with the glxinfo. I have install the mesa utilities and some other mesa related updates. Then it replaced the nvidia driver.
I had to re-install the driver and now i get the output .
Anything missing ?
Thanks
Sajjad
In your previous post -- After using GL_TEXTURE_RECTANGLE_ARB, did your code work fine?
It looks like the extension is supported.
However,
Your GL provider is NVIDIA. You should ask about this in their forums.
We cannot really provide any support here.
I am not sure why you are asking us. Please ask in NVIDIA forums.
-
Bruhaspati
Hi Himanshu,
You initially suspected that the error is because of the context creation . I am creating the context with opengl-opencl interoperability and it gave me success while checking with if(errNum != CL_SUCCESS).
I assume that the context creation is fine. To be i want to print out the context properties as character array .
Any hint on how to do it?
I can extract the context properties as an array of cl_context_properties. How to print it then ?
Thanks
Sajjadul
Hi folks,
What is the accurate way to check that the context creation is successful . I am checking it with if(errNum != CL_SUCCESS) , is it even the only way to check a successful context creation ?
I would like to know any better way to check if the created context is successful .
I am creating OpenCL context from OpenGL context . While OpenCL context creation i am not getting any trouble because it is returning CL_SUCCESS. But later when i am trying to create opencl buffer from the opengl buffer using the context, i am having the opencl error - CL_OUT_OF_RESOURCES. I was hinted that the error probably lies in the context creation.
I also created context without opengl opencl interoperability and it worked fine. So it seems that i have issues with the OpenGL context.
Is that possible to print out the context properties that is created with the opengl context ? Then i would have had more concrete information.
I looked into the function clGetContextInfo() and i can get the cl_context_properties[] array . How do i confirm that the array contain the opengl specific properties as well. Is there any way to print them out as character array ?
Looking forward to some hint here specially sample code example or at least a reference to it where you can extract and print cl_context_properties[] .
Thanks
Sajjadul
Hi
checking with err != CL_SUCCESS is enough to check whether the context created sucessfully or not..
One more place where you can check is...
You are computing the target address and assinging that to the variable target. check whether the computed address is valid or not. If that address is not allocated proparly or not available then there are chances to get such error. Please check that once and let me know..
Hi
I believe that you meant the changes inside the kernel. I did the following , but still i am getting the same cl error : alloc: 1825: Target Texture: unable to pull out the 2D OpenCL texture memory from the OpenGL memory: CL_OUT_OF_RESOURCES
/////////////////////////////////////////////////////////////////
.........
float4* target = (float4*) (((char*) trgBuffer ) + pitch * coord.y ) + coord.x;
if(target)
(*target) = color;
//////////////////////////////////////////////////////////////////
Is this how it should be done ?
Thanks
Sajjadul
The target will be having some address... So it never be NULL and it definetely execute the code in the if condition... Instead what i wanted you to check is whether that address is valid or not.
Please give us the test case attached and system configuration.
Hi
I believe that it is the C issue - to check if the address is valid or not. I checked this with the C++ forum and i am mentioned that there is no way to check the validity of a pointer. Is that so?
Any hint on this?
The system is NVDIA GTX 560M with OpenCL 1.1 spec and i am running with Ubuntu 12.04.
Any thing else ?
I have some opencl/opengl setup code with a basic kernel that draws a horizontal red line. It works on my system, so it might you pin down your error.
https://drive.google.com/folderview?id=0B5E_DYfYdZETcExpR3FlYU01V0E&usp=sharing