Results 1 to 6 of 6

Thread: Couldn't access any GPU devices!

  1. #1

    Couldn't access any GPU devices!

    I've got a problem with several programs I've done in OpenCL. None of them can access a GPU device. Even the "OpenCL in Action" samples, and the AMD APP SDK samples have the same problem on my PC.

    Hardware:
    CPU Intel Core i-7 4770K, Intel HD Graphics 4600
    GPU AMD Raedon HD 7900 Series

    Software:
    Windows 8.1 64bits
    Microsoft Visual Studio 2010
    Intel SDK for OpenCL Applications 2014
    AMD APP SDK 2.9
    Catalyst 14.4

    This is a basic program for device recognition:

    Code :
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
     
    #ifdef MAC
        #include <OpenCL/cl.h>
    #else
        #include <CL/cl.h>
    #endif
     
    void main()
    {
        cl_platform_id *plataformas;
        cl_device_id *dispositivos;
        cl_uint num_plataformas, num_dispositivos, dir_w, i, j;
        cl_int err;
        char *pform_nombre, *disp_nombre, *disp_vendedor;
        size_t psize_nombre, dsize_nombre, dsize_vendedor/*, dsize_dir*/;
     
        err = clGetPlatformIDs( 3 , NULL , &num_plataformas );
        if( err < 0 )
        {
    	perror( "Couldn't find any platforms" );
    	exit(1);
        }
        printf( "Number of installed platforms: %d\n" , num_plataformas );
        printf( "\n" );
        plataformas = ( cl_platform_id* ) malloc( sizeof( cl_platform_id ) * num_plataformas );
        clGetPlatformIDs( num_plataformas , plataformas , NULL );
     
        for( i = 0 ; i < num_plataformas ; i++ )
        {
      	err = clGetPlatformInfo( plataformas[i] , CL_PLATFORM_NAME , 0 , NULL , &psize_nombre );
    	if( err < 0  )
    	{
            	perror( "Couldn't read platform's name" );
    		exit(1);
    	}
    	pform_nombre = ( char* ) malloc( psize_nombre );
    	clGetPlatformInfo( plataformas[i] , CL_PLATFORM_NAME , psize_nombre , pform_nombre , NULL );
    	printf( "*PLATFORM: %s*\n" , pform_nombre );
     
    	err = clGetDeviceIDs( plataformas[i], CL_DEVICE_TYPE_ALL , 3 , NULL , &num_dispositivos );
    	if( err < 0 )
    	{
    		perror( "Couldn't access any devices" );
    		printf( "\n\n\n" );
    		system("pause");
    		exit(1);   
    	}
    	printf( "Devices: %d\n\n" , num_dispositivos );
    	dispositivos = ( cl_device_id* ) malloc( sizeof( cl_device_id ) * num_dispositivos );
    	clGetDeviceIDs( plataformas[i] , CL_DEVICE_TYPE_ALL , num_dispositivos , dispositivos , NULL );
     
    	for( j = 0 ; j < num_dispositivos ; j++ )
    	{
    		err = clGetDeviceInfo( dispositivos[j] , CL_DEVICE_NAME , 0 , NULL , &dsize_nombre );			
    		if( err < 0 )
    		{
    			perror( "Couldn't read device's name" );
    			exit(1);
    		}
    		disp_nombre = ( char* ) malloc( dsize_nombre );
    		clGetDeviceInfo( dispositivos[j] , CL_DEVICE_NAME , dsize_nombre , disp_nombre , NULL );
     
    		err = clGetDeviceInfo( dispositivos[j] , CL_DEVICE_VENDOR , 0 , NULL , &dsize_vendedor );			
    		if( err < 0 )
    		{
    			perror( "Couldn't read device's vendor" );
    			exit(1);
    		}
    		disp_vendedor = ( char* ) malloc( dsize_vendedor );
    		clGetDeviceInfo( dispositivos[j] , CL_DEVICE_VENDOR , dsize_vendedor , disp_vendedor , NULL );
     
    		clGetDeviceInfo( dispositivos[j] , CL_DEVICE_ADDRESS_BITS , 4096 , &dir_w , NULL );
     
    		printf( "  *DEVICE %d*\n" , j+1 );
    		printf( "  NAME: %s\n", disp_nombre );
    		printf( "  VENDOR: %s\n", disp_vendedor );
    		printf( "  BITS: %u\n" , dir_w );
    		printf( "\n" );
    		free( disp_nombre );
    		free( disp_vendedor );
    		}
    		free( dispositivos );
    		printf( "\n" );
     	}
    	free( plataformas );
    	printf( "\n" );
    	system( "pause" );
    }

    And this is the output:
    problem.jpg

    Neither the Intel HD Graphics and AMD GPU device are recognized. I don't know what is wrong, the program, drivers...
    The platforms are well recognized, but GPU devices don't.

    I really appreciate if someone of you could help me with this issue.

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    152
    It's always helpful to look at the error code you get back from OpenCL APIs. For example, what code to you get back from clGetDeviceIDs? Look it up in cl.h to get a clue as to what is happening.

  3. #3
    Thank you, that's a good idea.
    The error code from clGetDeviceIDs is -30. Where can I find what does it mean?

    err.jpg

  4. #4
    I don't know about the AMD issue, but as far as the Intel GPU goes, I have two thoughts:

    - On some platforms, OpenCL on the integrated GPU won't work if a discrete GPU is hosting the display. You could confirm this by connecting your monitor to the on-board graphics port and see if that changes anything.
    - Are you using remote desktop to interact with this machine? GPU OpenCL is often unavailable when using remote desktop.

    Hope this helps.

    Aaron

  5. #5
    When I connect the monitor to the on-board graphics port there's nothing on the screen. I have to unplug the power supply from the AMD card to allow the Intel HD Graphics work.
    Anyway, you are right. When the monitor is connected to the on-board graphics, the Intel GPU device is well recognized. But the AMD device still not working.

    HD.jpg

  6. #6
    Senior Member
    Join Date
    Dec 2011
    Posts
    152
    Quote Originally Posted by ALASgc View Post
    The error code from clGetDeviceIDs is -30. Where can I find what does it mean?
    err.jpg
    As I said, look it up in cl.h:

    #define CL_INVALID_VALUE -30

    Then look in the OpenCL specification for the API that is returning that error to see what it means.

    On page 35 it says that clGetDeviceIDs can return CL_INVALID_VALUE "if num_entries is equal to zero and devices is not NULL or if both num_devices and devices are NULL." Are you doing that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •