#include<stdio.h>
#include<CL/cl.h>
int main()
{
unsigned char j;
// Declarations propres a OpenCL
cl_platform_id id_plateforme;
cl_uint nb_plateformes, nb_devices ;
cl_uint compute_units, max_dimensions, global_mem_cacheline_size, address_bits ;
cl_ulong global_mem_size, local_mem_size, max_object_alloc_size, buffer_constant_mem_size, global_mem_cache_size ;
char *infos ;
size_t taille_infos, taille_par_groupe, global_memory, local_memory, nb_compute_units, nb_dimensions ;
size_t taille_par_dimension, max_work_group_size, max_alloc_size, buffer_memory, global_mem_cache_type_size, local_mem_type_size ;
size_t global_memory_cache, global_memory_cacheline, address_bits_size ;
cl_device_id liste_devices[2];
cl_device_type type_device;
cl_device_mem_cache_type global_mem_cache_type ;
cl_device_local_mem_type local_mem_type ;
size_t *tableau_dimension;
// Plateformes
if (clGetPlatformIDs(2,&id_plateforme,&nb_plateformes) == CL_SUCCESS)
{
printf(« Nb plateformes : %d\n »,nb_plateformes);
clGetPlatformInfo(id_plateforme,CL_PLATFORM_PROFILE,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetPlatformInfo(id_plateforme,CL_PLATFORM_PROFILE,taille_infos,infos,NULL);
printf(« PLATFORM_PROFILE : %s\n »,infos);
free(infos);
clGetPlatformInfo(id_plateforme,CL_PLATFORM_VERSION,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetPlatformInfo(id_plateforme,CL_PLATFORM_VERSION,taille_infos,infos,NULL);
printf(« PLATFORM_VERSION : %s\n »,infos);
free(infos);
clGetPlatformInfo(id_plateforme,CL_PLATFORM_NAME,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetPlatformInfo(id_plateforme,CL_PLATFORM_NAME,taille_infos,infos,NULL);
printf(« PLATFORM_NAME : %s\n »,infos);
free(infos);
clGetPlatformInfo(id_plateforme,CL_PLATFORM_VENDOR,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetPlatformInfo(id_plateforme,CL_PLATFORM_VENDOR,taille_infos,infos,NULL);
printf(« PLATFORM_VENDOR : %s\n »,infos);
free(infos);
clGetPlatformInfo(id_plateforme,CL_PLATFORM_EXTENSIONS,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetPlatformInfo(id_plateforme,CL_PLATFORM_EXTENSIONS,taille_infos,infos,NULL);
printf(« PLATFORM_EXTENSIONS : %s\n »,infos);
free(infos);
printf(« \n »);
// Devices
clGetDeviceIDs(id_plateforme,CL_DEVICE_TYPE_ALL,0,NULL,&nb_devices);
printf(« NOMBRE DEVICE :%d\n »,nb_devices);
if (clGetDeviceIDs(id_plateforme,CL_DEVICE_TYPE_ALL,2,liste_devices,&nb_devices) != CL_SUCCESS)
{
printf(« Erreur get device\n »);
exit(0);
};
int i=0 ;
for (j = 0; j < nb_devices-i; j++)
{
clGetDeviceInfo(liste_devices[j],CL_DEVICE_NAME,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_NAME,taille_infos,infos,NULL);
printf(« DEVICE NAME :%s\n »,infos);
free(infos);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_VERSION,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_VERSION,taille_infos,infos,NULL);
printf(« DEVICE VERSION :%s\n »,infos);
free(infos);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_OPENCL_C_VERSION,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_OPENCL_C_VERSION,taille_infos,infos,NULL);
printf(« DEVICE OPENCL C VERSION :%s\n »,infos);
free(infos);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_PROFILE,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_PROFILE,taille_infos,infos,NULL);
printf(« DEVICE PROFILE :%s\n »,infos);
free(infos);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_EXTENSIONS,0,NULL,&taille_infos);
infos = (char *)malloc(taille_infos*sizeof(char));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_EXTENSIONS,taille_infos,infos,NULL);
printf(« DEVICE EXTENSIONS :%s\n »,infos);
free(infos);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_COMPUTE_UNITS,0,NULL,&nb_compute_units);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_COMPUTE_UNITS,nb_compute_units,&compute_units,NULL);
printf(« DEVICE MAX COMPUTE UNITS :%d\n »,compute_units);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,0,NULL,&nb_dimensions);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,nb_dimensions,&max_dimensions,NULL);
printf(« DEVICE MAX WORK ITEM DIMENSIONS :%d\n »,max_dimensions);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_ITEM_SIZES,0,NULL,&taille_par_dimension);
tableau_dimension = (size_t *)malloc(taille_par_dimension*sizeof(size_t));
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_ITEM_SIZES,taille_par_dimension,tableau_dimension,NULL);
printf(« DEVICE MAX WORK ITEM SIZES :%ld %ld %ld\n »,tableau_dimension[0],tableau_dimension[1],tableau_dimension[2]);
free(tableau_dimension);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_GROUP_SIZE,0,NULL,&taille_par_groupe);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_WORK_GROUP_SIZE,taille_par_groupe,&max_work_group_size,NULL);
printf(« DEVICE MAX WORK GROUP SIZE :%ld\n »,max_work_group_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_SIZE,0,NULL,&global_memory);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_SIZE,global_memory,&global_mem_size,NULL);
printf(« DEVICE GLOBAL MEM SIZE :%ld\n »,global_mem_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_LOCAL_MEM_SIZE,0,NULL,&local_memory);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_LOCAL_MEM_SIZE,local_memory,&local_mem_size,NULL);
printf(« DEVICE LOCAL MEM SIZE :%ld\n »,local_mem_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,0,NULL,&buffer_memory);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,buffer_memory,&buffer_constant_mem_size,NULL);
printf(« DEVICE MAX CONSTANT BUFFER SIZE :%ld\n »,buffer_constant_mem_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHE_TYPE,0,NULL,&global_mem_cache_type_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHE_TYPE,global_mem_cache_type_size,&global_mem_cache_type,NULL);
printf(« DEVICE GLOBAL MEM CACHE TYPE :%d\n »,global_mem_cache_type);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_LOCAL_MEM_TYPE,0,NULL,&local_mem_type_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_LOCAL_MEM_TYPE,local_mem_type_size,&local_mem_type,NULL);
printf(« DEVICE LOCAL MEM TYPE :%d\n »,local_mem_type);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_MEM_ALLOC_SIZE,0,NULL,&max_alloc_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_MAX_MEM_ALLOC_SIZE,max_alloc_size,&max_object_alloc_size,NULL);
printf(« OBJECT MAX MEM ALLOC SIZE :%ld\n »,max_object_alloc_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHE_SIZE,0,NULL,&global_memory_cache);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHE_SIZE,global_memory_cache,&global_mem_cache_size,NULL);
printf(« DEVICE GLOBAL MEM CACHE SIZE :%ld\n »,global_mem_cache_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE,0,NULL,&global_memory_cacheline);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE,global_memory_cache,&global_mem_cacheline_size,NULL);
printf(« DEVICE GLOBAL MEM CACHELINE SIZE :%d\n »,global_mem_cacheline_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_ADDRESS_BITS,0,NULL,&address_bits_size);
clGetDeviceInfo(liste_devices[j],CL_DEVICE_ADDRESS_BITS,address_bits_size,&address_bits,NULL);
printf(« DEVICE ADDRESS BITS :%d\n »,address_bits);
printf(« \n »);
}
}
else printf(« Erreur clGetPlatformIDs\n »);
}
NOMBRE DEVICE :2
DEVICE NAME :GeForce GTX 470
DEVICE VERSION :OpenCL 1.1 CUDA
DEVICE OPENCL C VERSION :OpenCL C 1.1
DEVICE PROFILE :FULL_PROFILE
DEVICE EXTENSIONS :cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll 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_fp64
DEVICE MAX COMPUTE UNITS :14
DEVICE MAX WORK ITEM DIMENSIONS :3
DEVICE MAX WORK ITEM SIZES :1024 1024 64
DEVICE MAX WORK GROUP SIZE :1024
DEVICE GLOBAL MEM SIZE :1341849600
DEVICE LOCAL MEM SIZE :49152
DEVICE MAX CONSTANT BUFFER SIZE :65536
DEVICE GLOBAL MEM CACHE TYPE :2
DEVICE LOCAL MEM TYPE :1
OBJECT MAX MEM ALLOC SIZE :335462400
DEVICE GLOBAL MEM CACHE SIZE :229376
DEVICE GLOBAL MEM CACHELINE SIZE :128
DEVICE ADDRESS BITS :32
DEVICE NAME :Quadro FX 1800
DEVICE VERSION :OpenCL 1.0 CUDA
DEVICE OPENCL C VERSION :OpenCL C 1.0
DEVICE PROFILE :FULL_PROFILE
DEVICE EXTENSIONS :cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics
DEVICE MAX COMPUTE UNITS :8
DEVICE MAX WORK ITEM DIMENSIONS :3
DEVICE MAX WORK ITEM SIZES :512 512 64
DEVICE MAX WORK GROUP SIZE :512
DEVICE GLOBAL MEM SIZE :804585472
DEVICE LOCAL MEM SIZE :16384
DEVICE MAX CONSTANT BUFFER SIZE :65536
DEVICE GLOBAL MEM CACHE TYPE :0
DEVICE LOCAL MEM TYPE :1
OBJECT MAX MEM ALLOC SIZE :201146368
DEVICE GLOBAL MEM CACHE SIZE :0
DEVICE GLOBAL MEM CACHELINE SIZE :0
DEVICE ADDRESS BITS :32