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:
#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
" , num_plataformas );
printf( "
" );
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*
" , pform_nombre );
err = clGetDeviceIDs( plataformas[i], CL_DEVICE_TYPE_ALL , 3 , NULL , &num_dispositivos );
if( err < 0 )
{
perror( "Couldn't access any devices" );
printf( "
" );
system("pause");
exit(1);
}
printf( "Devices: %d
" , 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*
" , j+1 );
printf( " NAME: %s
", disp_nombre );
printf( " VENDOR: %s
", disp_vendedor );
printf( " BITS: %u
" , dir_w );
printf( "
" );
free( disp_nombre );
free( disp_vendedor );
}
free( dispositivos );
printf( "
" );
}
free( plataformas );
printf( "
" );
system( "pause" );
}
And this is the output:
[ATTACH=CONFIG]46[/ATTACH]
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.