2 Replies Latest reply on Mar 1, 2010 12:42 PM by mrmacete

    Programmatically detect ATI driver version on Windows XP

      Detect driver version to check for OpenCL support


      I would need to detect which version of the AMD/ATI driver is installed in a Windows XP System (32 bits) to know if it supports OpenCL, and avoid installing something that will not load properly if OpenCL is not installed.

      What are the ways to do this?

      I would really appreciate any hint you could give me.

      Thanks in advance,



        • Programmatically detect ATI driver version on Windows XP

          Here's the basic code. Part of this is from my script generated implementation of OpenCL reading someone's post on these forums gave me the idea to wrap the entire CL in a single class, and I ran with it...

          I left some slight amount of work for you to fill in...
          Good luck!

          #pragma once #include <cl.h> class DetectCL { typedef cl_int CL_API_CALL PclGetPlatformIDs( cl_uint, cl_platform_id*, cl_uint* ); typedef cl_int CL_API_CALL PclGetPlatformInfo( cl_platform_id, cl_platform_info, size_t, void*, size_t* ); DetectCL( const char* szDllLocation ) : m_hDLL( LoadLibraryA( szDllLocation ) ), m_pclGetPlatformIDs( NULL ), m_pclGetPlatformInfo( NULL ) { } ~DetectCL() throw() { FreeLibrary( m_hDLL ); } bool FInit() { m_pclGetPlatformIDs = (PclGetPlatformIDs *) ::GetProcAddress( m_hDLL, "clGetPlatformIDs" ); m_pclGetPlatformInfo = (PclGetPlatformInfo *) ::GetProcAddress( m_hDLL, "clGetPlatformInfo" ); return m_pclGetPlatformIDs != NULL && m_pclGetPlatformInfo != NULL; } // Method wrappers cl_int clGetPlatformIDs( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms ) { return m_pclGetPlatformIDs( num_entries, platforms, num_platforms ); } cl_int clGetPlatformInfo( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret ) { return m_pclGetPlatformInfo( platform, param_name, param_value_size, param_value, param_value_size_ret ); } // Member declarations PclGetPlatformIDs* m_pclGetPlatformIDs; PclGetPlatformInfo* m_pclGetPlatformInfo; HMODULE m_hDLL; }; // Somewhere down in your .cpp file // szPath can be relative or absolute bool IsCLInstalled( const char* szPath ) { DetectCL cl( path ); if( !cl.FInit() ) return false; if( !cl.FInit() ) return false; cl_uint numPlatforms = 0; if( CL_SUCCESS != dll.clGetPlatformIDs( 0, NULL, &numPlatforms ) || numPlatforms < 1 ) return false; cl_platform_id* platforms = calloc( numPlatforms, sizeof( cl_platform_id ) ); if( CL_SUCCESS != dll.clGetPlatformIDs( numPlatforms, &platforms, NULL ) ) { free( platforms ); return false; } // You might want to add something else to figure out -- like what platform you want, etc. for( cl_uint iPlatform = 0; iPlatform < numPlatforms; ++iPlatform ) { // Fill in this detail here looking for what you want to determine. if( CL_SUCCESS != cl.clGetPlatformInfo( platforms[ iPlatform ], CL_PLATFORM_NAME or CL_PLATFORM_VERSION or CL_PLATFORM_VENDOR, ... ) ) { free( platforms ); return false; } } free( platforms ); return true; }