/* ============================================================ * cl_info.c * Written by Steffen Boerm * All rights reserved. * * $Revision: 62$ * ============================================================ */ #include #include #include #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_TARGET_OPENCL_VERSION 120 #include int main() { cl_uint platforms, devices; cl_platform_id *platform; cl_device_id *device; cl_int result; cl_uint max_compute_units, max_clock_frequency; char *info; size_t infosize; cl_uint i, j; printf("========================================\n" "Querying number of platforms\n"); /* Calling clGetPlatformIDs with 0 in the first two arguments and * a pointer in the third returns the number of platforms */ result = clGetPlatformIDs(0, 0, &platforms); if(result != CL_SUCCESS) { printf("Error code %d\n", result); abort(); } /* Allocate storage for all platform id's */ platform = (cl_platform_id *) malloc((size_t) sizeof(cl_platform_id) * platforms); /* Calling clGetPlatformIDs with a number of platforms and a pointer * to enough storage returns the id's of the platforms */ result = clGetPlatformIDs(platforms, platform, 0); assert(result == CL_SUCCESS); printf(" %d platform(s)\n\n", platforms); for(i=0; i