Editing User:Rishabhsuthar32/GSoC20/Report

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 58: Line 58:
  
 
* '''Using Printf statement''': Another issue where I got stuck was being unable to use printf statement in OpenCL files. The strategy to debug opencl kernels using printf is to enable printf command by passing enumerations stated below in an array of context properties to the function, clCreateContext, which creates opencl context as follows:
 
* '''Using Printf statement''': Another issue where I got stuck was being unable to use printf statement in OpenCL files. The strategy to debug opencl kernels using printf is to enable printf command by passing enumerations stated below in an array of context properties to the function, clCreateContext, which creates opencl context as follows:
<pre>
 
 
CL_PRINTF_CALLBACK_ARM    0x40B0
 
CL_PRINTF_CALLBACK_ARM    0x40B0
 
CL_PRINTF_BUFFERSIZE_ARM  0x40B1
 
CL_PRINTF_BUFFERSIZE_ARM  0x40B1
 
cl_context_properties context_properties[] =
 
cl_context_properties context_properties[] =
 
{
 
{
CL_PRINTF_CALLBACK_ARM, (cl_context_properties)printf_callback,
+
    CL_PRINTF_CALLBACK_ARM, (cl_context_properties)printf_callback,
CL_PRINTF_BUFFERSIZE_ARM, (cl_context_properties)0x100000,
+
    CL_PRINTF_BUFFERSIZE_ARM, (cl_context_properties)0x100000,
CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
+
    CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
0
+
    0
 
};
 
};
</pre>
+
 
 
This enables the device side printf built in function for OpenCL C versions prior to 1.2. It also extends the cl_context_properties enumeration to allow a user defined printf callback and/or printf buffer size. OpenCL kernel code then has access to:
 
This enables the device side printf built in function for OpenCL C versions prior to 1.2. It also extends the cl_context_properties enumeration to allow a user defined printf callback and/or printf buffer size. OpenCL kernel code then has access to:
  #pragma OPENCL EXTENSION cl_arm_printf : enable
+
    #pragma OPENCL EXTENSION cl_arm_printf : enable
 
This pragma must be enabled for a kernel to have access to the printf built in function in OpenCL C versions prior to 1.2.
 
This pragma must be enabled for a kernel to have access to the printf built in function in OpenCL C versions prior to 1.2.
  
 
For the purpose of debugging in mged I used bu_log instead of printf by passing following array of context properties
 
For the purpose of debugging in mged I used bu_log instead of printf by passing following array of context properties
<pre>
 
 
cl_context_properties context_properties[] =
 
cl_context_properties context_properties[] =
 
{
 
{
CL_PRINTF_CALLBACK_ARM, (cl_context_properties)bu_log,
+
    CL_PRINTF_CALLBACK_ARM, (cl_context_properties)bu_log,
CL_PRINTF_BUFFERSIZE_ARM, (cl_context_properties)0x100000,
+
    CL_PRINTF_BUFFERSIZE_ARM, (cl_context_properties)0x100000,
CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
+
    CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
0
+
    0
 
};
 
};
</pre>
 
  
 
But unfortunately this doesn't work and reports error that context cannot be created. This needs further investigation. The print statement would also be useful for debugging the memory allocation issue, as to where and why it is failing.
 
But unfortunately this doesn't work and reports error that context cannot be created. This needs further investigation. The print statement would also be useful for debugging the memory allocation issue, as to where and why it is failing.

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)