AvtechScientific / ASL

Advanced Simulation Library - hardware accelerated multiphysics simulation platform.
http://asl.org.il
GNU Affero General Public License v3.0
217 stars 55 forks source link

Small problem causes “call to 'select' is ambiguous” in all level set examples #36

Open metorm opened 6 years ago

metorm commented 6 years ago

I am testing the level set examples provided with the source. However, all level set examples: levelSetBasic levelSetFacetedGrowth levelSetNormalGrowth gives run time error:

            BUILD LOG
 ************************************************
<kernel>:239:10: error: call to 'select' is ambiguous
        (pv_f64=select((pv_f64/1.8000000000000000444), (pv_f64/(1. - pv_f64)), (pv_f64*pv_f4<0)));
                ^~~~~~
cl_kernel.h:16067:23: note: candidate function
int __OVERLOADABLE__  select(int a, int b, int c);
                      ^
cl_kernel.h:16073:24: note: candidate function
uint __OVERLOADABLE__  select(uint a, uint b, int c);
                       ^
[below is all those overload versions of the select function]

and the kernel source being compiled is:

            KERNEL SOURCE CODE
 ------------------------------------------------
#pragma OPENCL EXTENSION cl_khr_fp64 : disable

__kernel void compute_1(__global float *a_f2,
                        __global float *a_f1)
{
    uint index = get_glterminate called after throwing an instance of 'std::logic_error'
obal_id(0);
    float pv_f4;
    float pv_f9;

...

    (pv_f64=select((pv_f64/1.8000000000000000444), (pv_f64/(1. - pv_f64)), (pv_f64*pv_f4<0)));
    a_f2[(index+10507)] = select((float)(pv_f64), (float)(sign(pv_f4)), (int)(((pv_f65+pv_f67)<0.10000000000000000555)));
}
 ------------------------------------------------

it seems that in the last line, pv_f64=select((pv_f64/1.8000000000000000444), (pv_f64/(1. - pv_f64)), (pv_f64*pv_f4<0)), a type indicator is requird. I believe this is easy to fix, but I don't know where to find the code which generated the above OpenCL kernel. I am new to ASL yet. Someone please fix this or tell me where to start to fix this?

metorm commented 6 years ago

Environment: manjaro linux NVIDIA opencl implementation gcc-7

metorm commented 6 years ago

I solved the problem by myself. See #37