Results 1 to 5 of 5

Thread: Way to know if OpenCL is installed

  1. #1

    Way to know if OpenCL is installed


    I got a problem. Imagine my app uses OpenCL but it requires to be compatible with old OSs and computers. The user might use an old driver without OpenCL suport.
    Currently, if I link my program with the OpenCL.lib/OpenCL.dll then the dynamic-library reference will make my program impossible to be executed. It's neither possible to use "delayed DLL" calls, because Windows will emit a "Sorry can't find OpenCL.dll DLL" message box the first time you call a clXXXXXXX function.

    To solve that, you should add an INLINED function in the OpenCL.h file to know if OpenCL is available. For instance, in case of Windows, it could be like this:

    Code :
    void inline int IsOpenCLInstalled ()
        #ifdef WIN32
           FILE *f = fopen("$WINDIR\\system32\\OpenCL.dll");
           if ( f!=NULL )
               return 1;
           return 0;
           /* perform OpenCL runtime detection for other OSs */


  2. #2
    Junior Member
    Join Date
    May 2011

    Re: Way to know if OpenCL is installed

    Thanks for the straightforward solution.

  3. #3

    Re: Way to know if OpenCL is installed

    This is a really informative comment. My problem has already been fixed...

  4. #4
    Senior Member
    Join Date
    May 2010
    Toronto, Canada

    Re: Way to know if OpenCL is installed

    I would suggest dynamically opening the library with LoadLibrary()/dlopen() instead.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  5. #5

    Re: Way to know if OpenCL is installed

    It would be handy to try to ask the available OpenCL context versions.
    If it fails no library.
    If it returns something useful you can immediately start working with that.

Similar Threads

  1. Replies: 1
    Last Post: 07-27-2012, 11:06 AM
  2. Replies: 2
    Last Post: 11-01-2011, 03:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean