Build Program Failure ERROR

33 views
Skip to first unread message

Gabriel Villalobos

unread,
Mar 11, 2021, 4:01:12 PM3/11/21
to boost-compute

Hello!

I am trying to learn to use the library. I am following the example at:


I've added the flag :

#ifndef BOOST_COMPUTE_DEBUG_KERNEL_COMPILATION
 # define BOOST_COMPUTE_DEBUG_KERNEL_COMPILATION
#endif

I compile it with :

g++  04_transform.cpp -lOpenCL -o 04.exe

When I run it, I obtain:

Boost.Compute: kernel compilation failed (-11)
--- source ---
#define boost_pair_type(t1, t2) _pair_ ## t1 ## _ ## t2 ## _t
#define boost_pair_get(x, n) (n == 0 ? x.first ## x.second)
#define boost_make_pair(t1, x, t2, y) (boost_pair_type(t1, t2)) { x, y }
#define boost_tuple_get(x, n) (x.v ## n)


__kernel void copy(__global int* _buf0, const uint count)
{
uint index = get_local_id(0) + (512 * get_group_id(0));
for(uint i = 0; i < 4; i++){
    if(index < count){
_buf0[index]=sqrt(_buf0[index]);
       index += 128;
    }
}

}

--- build log ---
<kernel>:12:14: error: call to 'sqrt' is ambiguous
_buf0[index]=sqrt(_buf0[index]);
             ^~~~
cl_kernel.h:1752:25: note: candidate function
double __OVERLOADABLE__ sqrt(double);
                        ^
cl_kernel.h:1753:25: note: candidate function
float2 __OVERLOADABLE__ sqrt(float2);
                        ^
cl_kernel.h:1755:25: note: candidate function
float3 __OVERLOADABLE__ sqrt(float3);
                        ^
cl_kernel.h:1757:25: note: candidate function
float4 __OVERLOADABLE__ sqrt(float4);
                        ^
cl_kernel.h:1758:25: note: candidate function
float8 __OVERLOADABLE__ sqrt(float8);
                        ^
cl_kernel.h:1759:26: note: candidate function
float16 __OVERLOADABLE__ sqrt(float16);
                         ^
cl_kernel.h:1760:26: note: candidate function
double2 __OVERLOADABLE__ sqrt(double2);
                         ^
cl_kernel.h:1762:26: note: candidate function
double3 __OVERLOADABLE__ sqrt(double3);
                         ^
cl_kernel.h:1764:26: note: candidate function
double4 __OVERLOADABLE__ sqrt(double4);
                         ^
cl_kernel.h:1765:26: note: candidate function
double8 __OVERLOADABLE__ sqrt(double8);
                         ^
cl_kernel.h:1766:27: note: candidate function
double16 __OVERLOADABLE__ sqrt(double16);
                          ^
cl_kernel.h:6276:24: note: candidate function
float __OVERLOADABLE__ sqrt(float in);
                       ^

terminate called after throwing an instance of 'boost::wrapexcept<boost::compute::program_build_failure>'
  what():  Build Program Failure
Aborted (core dumped)


which is kind of cryptic, but I guess the sqrt function type is to blame? is this a function of the library itself?

Thanks!

Reply all
Reply to author
Forward
0 new messages