<?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 CL_BUILD_PROGRAM_FAILURE - unknown problem in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775365#M236</link>
    <description>You can also use the Intel's offline compiler to see why your program failed to build. But I think your problem may be related to the cl_khr_int64_base_atomics extension. Make sure the particular extension is supported on the platform by calling clGetDeviceInfo() with CL_DEVICE_EXTENSIONS before using any functions supported by the extension.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Raghu</description>
    <pubDate>Wed, 01 Aug 2012 18:05:34 GMT</pubDate>
    <dc:creator>Raghupathi_M_Intel</dc:creator>
    <dc:date>2012-08-01T18:05:34Z</dc:date>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775363#M234</link>
      <description>[bash]
const char* OpenCLSource[] = {

"#pragma OPENCL EXTENSION cl_khr_fp64 : enable",
"#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable",
"",
"struct complex_double",

"{",

"	double real;",

"	double imag;",

"};",
"",
"double atom_add_double(__global double* const address, const double value)",
"{",
"  long oldval, newval, readback;",
"",
"  *(double*)&amp;amp;oldval = *address;",
"  *(double*)&amp;amp;newval = (*(double*)&amp;amp;oldval + value);",
"  while ((readback = atom_cmpxchg((__global long*)address, oldval, newval)) != oldval) {",
"    oldval = readback;",
"    *(double*)&amp;amp;newval = (*(double*)&amp;amp;oldval + value);",
"  }",
"  return *(double*)&amp;amp;oldval;",
"}",
"",
"",
"__kernel void dqft_ocl_kernel(__global complex_double *q_register, __global complex_double *init, __global unsigned long long *q)",
"{",
" // Index of the elements to add \n",
" unsigned long long int idx = get_global_id(0);",
" // Sum the n'th element of vectors a and b and store in c \n",
"/*	complex_double tmpcomp;",
"	complex_double tmpcomp2;",
"",
"	double epsilon;",
"",
"	epsilon = pow(10,-14);",

"",

"",

"	if ((pow(q_register[2*idx], 2) + pow(q_register[2*idx+1], 2)) &amp;gt; epsilon)",

"	{",

"		for (unsigned long long int c = 0 ; c &amp;lt; q[0] ; c++)",

"		{",

"			tmpcomp.real = pow(q,-.5) * cos(2*PI*idx*c/q);",

"			tmpcomp.imag = pow(q,-.5) * sin(2*PI*idx*c/q);",
"",
"			tmpcomp2.real = (q_register[idx].real * tmpcomp.real) - (q_register[idx].imag * tmpcomp.imag);",
"			tmpcomp2.imag = (q_register[idx].imag * tmpcomp.real) - (q_register[idx].real * tmpcomp.imag);",
"",
"			atom_add_double(&amp;amp;init&lt;C&gt;.real, tmpcomp2_real);",
"			atom_add_double(&amp;amp;init&lt;C&gt;.imag, tmpcomp2_imag);",

"",

"			//init&lt;C&gt; = complex_add(init&lt;C&gt;, complex_mul(q_register[idx], tmpcomp));",

"		}",

"	}",

"*/",
"}"
"",
"",
"",
"",
};



void dqft_ocl(complex_double q_register[], unsigned long long int q)

{



	// EN: The Fourier transform maps functions in the time domain to

	//     functions in the frequency domain.  Frequency is 1/period, thus

	//     this Fourier transform will take our periodic register, and peak it

	//     at multiples of the inverse period.  Our Fourier transformation on

	//     the state a takes it to the state: q^(-.5) * Sum[c = 0 -&amp;gt; c = q - 1,

	//     c * e^(2*Pi*i*a*c / q)].  Remember, e^ix = cos x + i*sin x.



	complex_double init&lt;Q&gt;;


	unsigned long long i;

	for(i = 0; i &amp;lt; q; i++)

	{

		init&lt;I&gt;.real = 0;
		init&lt;I&gt;.imag = 0;



	}

	// Query platform ID
	cl_platform_id platform;
	clGetPlatformIDs (1, &amp;amp;platform, NULL);



	// Setup context properties
	cl_context_properties props[3];
	props[0] = (cl_context_properties)CL_CONTEXT_PLATFORM;
	props[1] = (cl_context_properties)platform;
	props[2] = (cl_context_properties)0;



	// Create a context to run OpenCL on our CUDA-enabled NVIDIA GPU
	cl_context GPUContext = clCreateContextFromType(props, CL_DEVICE_TYPE_GPU,NULL, NULL, NULL);


	// Get the list of GPU devices associated with this context
	size_t ParmDataBytes;
	clGetContextInfo(GPUContext, CL_CONTEXT_DEVICES, 0, NULL, &amp;amp;ParmDataBytes);
	cl_device_id* GPUDevices = (cl_device_id*)malloc(ParmDataBytes);
	clGetContextInfo(GPUContext, CL_CONTEXT_DEVICES, ParmDataBytes, GPUDevices, NULL);


	// Create a command-queue on the first GPU device
	cl_command_queue GPUCommandQueue = clCreateCommandQueue(GPUContext, GPUDevices[0], 0, NULL);


	// Allocate GPU memory for source vectors AND initialize from CPU memory
	cl_mem GPUVector1 = clCreateBuffer(GPUContext, CL_MEM_READ_ONLY |
	CL_MEM_COPY_HOST_PTR, sizeof(complex_double) * q, q_register, NULL);

	cl_mem GPUVector2 = clCreateBuffer(GPUContext, CL_MEM_READ_WRITE |
	CL_MEM_COPY_HOST_PTR, sizeof(complex_double) * q, init, NULL);

	cl_mem GPU_q = clCreateBuffer(GPUContext, CL_MEM_READ_ONLY |
	CL_MEM_COPY_HOST_PTR, sizeof(unsigned long long int), &amp;amp;q, NULL);


	// Create OpenCL program with source code
	cl_program OpenCLProgram = clCreateProgramWithSource(GPUContext, 57, OpenCLSource, NULL, NULL);

	int err;

	// Build the program (OpenCL JIT compilation)
	err = clBuildProgram(OpenCLProgram, 0, NULL, NULL, NULL, NULL);

	// Create a handle to the compiled OpenCL function (Kernel)
	cl_kernel OpenCLVectorAdd = clCreateKernel(OpenCLProgram, "dqft_ocl_kernel", NULL);

	// In the next step we associate the GPU memory with the Kernel arguments
	clSetKernelArg(OpenCLVectorAdd, 0, sizeof(cl_mem), (void*)&amp;amp;GPUVector1);
	clSetKernelArg(OpenCLVectorAdd, 1, sizeof(cl_mem), (void*)&amp;amp;GPUVector2);
	clSetKernelArg(OpenCLVectorAdd, 2, sizeof(unsigned long long int), &amp;amp;GPU_q);

	// Launch the Kernel on the GPU
	size_t WorkSize[1] = {12}; // one dimensional Range
	err = clEnqueueNDRangeKernel(GPUCommandQueue, OpenCLVectorAdd, 1, NULL, WorkSize, NULL, 0, NULL, NULL);



	clEnqueueReadBuffer(GPUCommandQueue, GPUVector2, CL_TRUE, 0, q * sizeof(complex_double), q_register, 0, NULL, NULL);

	// Cleanup
	free(GPUDevices);
	clReleaseKernel(OpenCLVectorAdd);
	clReleaseProgram(OpenCLProgram);
	clReleaseCommandQueue(GPUCommandQueue);
	clReleaseContext(GPUContext);
	clReleaseMemObject(GPUVector1);
	clReleaseMemObject(GPUVector2);

	vector_normalization_sp(q_register, q);


}[/bash] I have a problem. The function clBuildProgram returns CL_BUILD_PROGRAM_FAILURE . Where is the problem?&lt;/I&gt;&lt;/I&gt;&lt;/Q&gt;&lt;/C&gt;&lt;/C&gt;&lt;/C&gt;&lt;/C&gt;</description>
      <pubDate>Wed, 01 Aug 2012 16:31:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775363#M234</guid>
      <dc:creator>Lukasz_Swierczewski</dc:creator>
      <dc:date>2012-08-01T16:31:30Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775364#M235</link>
      <description>This is where clGetProgramBuildInfo() becomes so useful. &lt;BR /&gt;&lt;BR /&gt;[cpp]size_t log;
clGetProgramBuildInfo(program, NULL, CL_PROGRAM_BUILD_LOG, 0, NULL, &amp;amp;log);
char *buildlog = malloc(log*sizeof(char));
clGetProgramBuildInfo(program, NULL, CL_PROGRAM_BUILD_LOG, log, buildlog, NULL);
printf(buildlog);[/cpp]&lt;BR /&gt;&lt;BR /&gt;put these statements right after your program build call. You can see what exactly is the error..</description>
      <pubDate>Wed, 01 Aug 2012 17:51:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775364#M235</guid>
      <dc:creator>nikey1</dc:creator>
      <dc:date>2012-08-01T17:51:47Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775365#M236</link>
      <description>You can also use the Intel's offline compiler to see why your program failed to build. But I think your problem may be related to the cl_khr_int64_base_atomics extension. Make sure the particular extension is supported on the platform by calling clGetDeviceInfo() with CL_DEVICE_EXTENSIONS before using any functions supported by the extension.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Raghu</description>
      <pubDate>Wed, 01 Aug 2012 18:05:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775365#M236</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2012-08-01T18:05:34Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775366#M237</link>
      <description>=== 1 OpenCL platform(s) found: ===&lt;BR /&gt; -- 0 --&lt;BR /&gt; PROFILE = FULL_PROFILE&lt;BR /&gt; VERSION = OpenCL 1.0 CUDA 3.2.1&lt;BR /&gt; NAME = NVIDIA CUDA&lt;BR /&gt; VENDOR = NVIDIA Corporation&lt;BR /&gt; EXTENSIONS = cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll &lt;BR /&gt;=== 1 OpenCL device(s) found on platform:&lt;BR /&gt; -- 0 --&lt;BR /&gt; DEVICE_NAME = Tesla C2050&lt;BR /&gt; DEVICE_VENDOR = NVIDIA Corporation&lt;BR /&gt; DEVICE_VERSION = OpenCL 1.0 CUDA&lt;BR /&gt; DRIVER_VERSION = 260.19.26&lt;BR /&gt; CL_DEVICE_EXTENSIONS = cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 &lt;BR /&gt; DEVICE_MAX_COMPUTE_UNITS = 14&lt;BR /&gt; DEVICE_MAX_CLOCK_FREQUENCY = 1147&lt;BR /&gt; DEVICE_GLOBAL_MEM_SIZE = 2817982464&lt;BR /&gt; -- 1 --&lt;BR /&gt; DEVICE_NAME = GeForce GTS 250&lt;BR /&gt; DEVICE_VENDOR = NVIDIA Corporation&lt;BR /&gt; DEVICE_VERSION = OpenCL 1.0 CUDA&lt;BR /&gt; DRIVER_VERSION = 260.19.26&lt;BR /&gt; CL_DEVICE_EXTENSIONS = cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics &lt;BR /&gt; DEVICE_MAX_COMPUTE_UNITS = 16&lt;BR /&gt; DEVICE_MAX_CLOCK_FREQUENCY = 1458&lt;BR /&gt; DEVICE_GLOBAL_MEM_SIZE = 1073414144&lt;SPAN class="sectionBody"&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;I use nVidia Tesla C2050. This card supports integer atomic functions operating on 64-bit words in global memory (required compute capability &amp;gt;= 1.2).&lt;BR /&gt;&lt;BR /&gt;Why is not available extend cl_khr_int64_base_atomics?</description>
      <pubDate>Thu, 02 Aug 2012 10:18:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775366#M237</guid>
      <dc:creator>Lukasz_Swierczewski</dc:creator>
      <dc:date>2012-08-02T10:18:01Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775367#M238</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt; I use nVidia Tesla C2050. This card supports integer atomic functions operating on 64-bit words in global memory (required compute capability &amp;gt;= 1.2).&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; Why is not available extend cl_khr_int64_base_atomics?&lt;BR /&gt;&lt;BR /&gt;Because looks like your driver only supports OpenCL 1.0. May be you need to upgrade the driver? 295.59 is the latest driver (from NVidia's website) for this card.&lt;BR /&gt;&lt;BR /&gt;Raghu&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 12:11:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775367#M238</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2012-08-02T12:11:10Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775368#M239</link>
      <description>Card does not perform operations on the double. CL_INVALID_BINARY is returned.&lt;BR /&gt;&lt;BR /&gt;I add a pragma:&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;#pragma OPENCL EXTENSION cl_khr_fp64 : enable&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;The device has cl_khr_fp64 extensions. This extension is visible in the system.&lt;BR /&gt;&lt;BR /&gt;This is a problem with the version of OpenCL?</description>
      <pubDate>Wed, 08 Aug 2012 18:56:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775368#M239</guid>
      <dc:creator>Lukasz_Swierczewski</dc:creator>
      <dc:date>2012-08-08T18:56:34Z</dc:date>
    </item>
    <item>
      <title>CL_BUILD_PROGRAM_FAILURE - unknown problem</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775369#M240</link>
      <description>I am not really sure I understand your problem/question. &lt;BR /&gt;&lt;BR /&gt;Earlier you reported you were running into an issue with cl_khr_int64_base_atomics, but now it appears there is a problem with cl_khr_fp64. Before debugging the issue please make sure you have the latest driver for your device andbefore enabling an extension make sure the device supports it. &lt;BR /&gt;&lt;BR /&gt;Moreover, if you are running on an Nvidia device, please post on their forum since you are most likely to get correct advice there for running applications on their devices.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Raghu&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2012 19:35:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CL-BUILD-PROGRAM-FAILURE-unknown-problem/m-p/775369#M240</guid>
      <dc:creator>Raghupathi_M_Intel</dc:creator>
      <dc:date>2012-08-08T19:35:43Z</dc:date>
    </item>
  </channel>
</rss>

