Menu

Unsupported platform exception

Help
2010-02-18
2013-04-25
  • Lutz v. Grafenstein

    Hi

    i wonder if the following exception is expected, and if not how to resolve it.

    thx, Lutz

    > clcc lesson1_kernels.cl -device_type GPU
    ..\src\main.cpp(230): Throw in function int __cdecl main(int,char *)
    Dynamic exception type: class boost::exception_detail::clone_impl<struct boost::exception_detail::error_info_injector<cl
    ass std::runtime_error> >
    std::exception::what: CL_INVALID_PLATFORM
    > clcc -info
    1 OpenCL Platform detected
        Platform
            id         = 01961434
            profile    = FULL_PROFILE
            version    = OpenCL 1.0 ATI-Stream-v2.0.0
            name       = ATI Stream
            vendor     = Advanced Micro Devices, Inc.
            extensions =

            2 Devices detected
                Device
                    id                            = 01A8E310
                    type                          = CL_DEVICE_TYPE_CPU
                    name                          = Intel(R) Core(TM)2 Duo CPU     E8500  @ 3.16GHz
                    vendor                        = GenuineIntel
                    driver version                = 1.0
                    device version                = OpenCL 1.0 ATI-Stream-v2.0.0
                    profile                       = FULL_PROFILE
                    max compute units             = 2
                    max work items dimensions     = 3
                    max work item sizes           = 1024 / 1024 / 1024
                    max work group size           = 1024
                    max clock frequency           = 3158 MHz
                    address_bits                  = 32
                    max mem alloc size            = 512 MB
                    global mem size               = 1024 MB
                    image support                 = CL_FALSE
                    max read image args           = 0
                    max write image args          = 0
                    2D image max size             = 0 x 0
                    3D image max size             = 0 x 0 x 0
                    max samplers                  = 0
                    max parameter size            = 4096
                    mem base addr align           = 1024
                    min data type align size      = 128
                    single fp config              = CL_FP_DENORM CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
                    global mem cache type         = CL_READ_WRITE_CACHE
                    global mem cacheline size     = 64
                    global mem cache size         = 65536
                    max constant buffer size      = 64 KB
                    max constant args             = 8
                    local mem type                = CL_GLOBAL
                    local mem size                = 32 KB
                    error correction support      = CL_FALSE
                    profiling timer resolution    = 1 ns
                    endian little                 = CL_TRUE
                    available                     = CL_TRUE
                    compiler available            = CL_TRUE
                    execution capabilities        = CL_EXEC_KERNEL
                    queue properties              = CL_QUEUE_PROFILING_ENABLE
                    extensions                    = 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_byte_addressable_store

                Device
                    id                            = 01A8FD48
                    type                          = CL_DEVICE_TYPE_GPU
                    name                          = ATI RV770
                    vendor                        = Advanced Micro Devices, Inc.
                    driver version                = CAL 1.4.515
                    device version                = OpenCL 1.0 ATI-Stream-v2.0.0
                    profile                       = FULL_PROFILE
                    max compute units             = 10
                    max work items dimensions     = 3
                    max work item sizes           = 256 / 256 / 256
                    max work group size           = 256
                    max clock frequency           = 750 MHz
                    address_bits                  = 32
                    max mem alloc size            = 128 MB
                    global mem size               = 128 MB
                    image support                 = CL_FALSE
                    max read image args           = 0
                    max write image args          = 0
                    2D image max size             = 0 x 0
                    3D image max size             = 0 x 0 x 0
                    max samplers                  = 0
                    max parameter size            = 1024
                    mem base addr align           = 32768
                    min data type align size      = 128
                    single fp config              = CL_FP_INF_NAN CL_FP_ROUND_TO_NEAREST
                    global mem cache type         = CL_NONE
                    max constant buffer size      = 64 KB
                    max constant args             = 8
                    local mem type                = CL_GLOBAL
                    local mem size                = 16 KB
                    error correction support      = CL_FALSE
                    profiling timer resolution    = 1 ns
                    endian little                 = CL_TRUE
                    available                     = CL_TRUE
                    compiler available            = CL_TRUE
                    execution capabilities        = CL_EXEC_KERNEL
                    queue properties              = CL_QUEUE_PROFILING_ENABLE
                    extensions                    =

     
  • George van Venrooij

    Hi Lutz,

      At first glance this command should work as advertised, but it obviously doesn't, although I cannot see any clear reason for it, since your system has a GPU device available.

      What happens if you run clcc without specifying a device type?

    Regards,

      George

     
  • Lutz v. Grafenstein

    Hi George

    Same exception occurs in that case. Could it have to do with the AMD OpenCL implementation? When adapting OpenCL code samples which were written for other implementations (namely Apple) i noticed that the AMD apparently requires you to query the platform before getting the devices, which seems not to be the case for other implementations (assuming that the code does run on other implementations…)

    Thx, Lutz

     
  • George van Venrooij

    Hello Lutz,

      Sorry for replying late, but apparently the monitoring functionality isn't working as advertised, since I don't get e-mails when someone posts a message in the forum. Need to figure out why that happens.

      I'm assuming you've built CLCC from source and are able to modify the source code. If that is the case try changing main.cpp line 224 from:

            if (options.build() == true)
            {
                //  Create a context of the given type
                cl::shared_context ctx = clCreateContextFromType(NULL, options.device_type(), NULL, NULL, &error);
    

    into the following:

            if (options.build() == true)
            {
                //  Create a driver first (seems to be needed on some AMD implementations)
                cl::driver cldriver;
                //  Create a context of the given type
                cl::shared_context ctx = clCreateContextFromType(NULL, options.device_type(), NULL, NULL, &error);
    

    and let me know if that solves your problem.

    Regards,

      George

     
  • Lutz v. Grafenstein

    no doesn't solve the problem. but i think i found the solution:

    http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71

    in short AMD latest SDK requires you to _not_ pass NULL in first argument of

    clCreateContextFromType(NULL,…

    AMD deviates here somewhat from the version of the standard i have:

    "The function
    cl_context
    clCreateContextFromType (cl_context_properties properties,
    cl_device_type device_type,
    void (*pfn_notify)(const char *errinfo,
    const void *private_info, size_t cb,
    void *user_data),
    void *user_data,
    cl_int *errcode_ret)
    creates an OpenCL context from a device type that identifies the specific device(s) to use.
    properties is reserved and must be zero."

    thanks

    Lutz

     
  • Lutz v. Grafenstein

    i replaced

    // Create a context of the given type cl::shared_context ctx = clCreateContextFromType(NULL, options.device_type(), NULL, NULL, &error);
    

    now with

    //  Create a context of the given type
                cl_uint numPlatforms;
                cl_platform_id platform = NULL;
                error = clGetPlatformIDs(0, NULL, &numPlatforms);
                CLCALL(error);
                if (0 < numPlatforms) 
                {
                    cl_platform_id* platforms = new cl_platform_id[numPlatforms];
                    error = clGetPlatformIDs(numPlatforms, platforms, NULL);
                    CLCALL(error);
                    for (unsigned i = 0; i < numPlatforms; ++i) 
                    {
                        char pbuf[100];
                        error = clGetPlatformInfo(platforms[i],
                            CL_PLATFORM_VENDOR,
                            sizeof(pbuf),
                            pbuf,
                            NULL);
                        CLCALL(error);
                        platform = platforms[i];
                        if (!strcmp(pbuf, "Advanced Micro Devices, Inc.")) 
                        {
                            break;
                        }
                    }
                    delete[] platforms;
                }
                /*
                * If we could find our platform, use it. Otherwise pass a NULL and get whatever the
                * implementation thinks we should be using.
                */
                cl_context_properties cps[3] = 
                {
                    CL_CONTEXT_PLATFORM, 
                    (cl_context_properties)platform, 
                    0
                };
                /* Use NULL for backward compatibility */
                cl_context_properties* cprops = (NULL == platform) ? NULL : cps;
                cl::shared_context ctx = clCreateContextFromType(cprops, options.device_type(), NULL, NULL, &error);
    

    Would be interesting to know if that again works with other implementations

     

Log in to post a comment.