Skip to content

Commit

Permalink
Changed the output to display all available OpenCL profiles on the sy…
Browse files Browse the repository at this point in the history
…stem.
  • Loading branch information
jasonjtyler committed Oct 24, 2012
1 parent c9def36 commit c05ea97
Showing 1 changed file with 41 additions and 22 deletions.
63 changes: 41 additions & 22 deletions OpenCL.GetParameterInfo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ void main(void)
cl_int error = 0; // Used to handle error codes.
cl_uint entryCount = 1;
cl_uint platformCount;
cl_platform_id platform;
cl_platform_id* platforms;
char *profile;
char *version;
char *name;
char *vendor;
char *extensions;
int index;

//Display console
hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
Expand All @@ -28,33 +29,51 @@ void main(void)
exit(-1);
}

//Platform count
error = clGetPlatformIDs(0, NULL, &platformCount);
if (error != CL_SUCCESS) {
printf("Error getting platform count");
exit(error);
}

platforms = (cl_platform_id*)calloc(platformCount, sizeof(cl_platform_id));

//Platform
error = clGetPlatformIDs(entryCount, &platform, &platformCount);
error = clGetPlatformIDs(platformCount, platforms, NULL);
if (error != CL_SUCCESS) {
printf("Error getting platform id");
exit(error);
}

profile = getPlatformInfo(platform, CL_PLATFORM_PROFILE);
version = getPlatformInfo(platform, CL_PLATFORM_VERSION);
name = getPlatformInfo(platform, CL_PLATFORM_NAME);
vendor = getPlatformInfo(platform, CL_PLATFORM_VENDOR);
extensions = getPlatformInfo(platform, CL_PLATFORM_EXTENSIONS);

printf("\nPlatform ID: %i ", platform);
printf("\nPlatform profile: %s ", profile);
printf("\nPlatform version: %s ", version);
printf("\nPlatform name: %s ", name);
printf("\nPlatform vendor: %s ", vendor);
printf("\nPlatform extensions: %s ", extensions);

free(profile);
free(version);
free(name);
free(vendor);
free(extensions);

printf("\n\n\n\n\tPress any key to exit...\n");
printf("\nPlatform count: %i", platformCount);
printf("\n");

for (index = 0; index < platformCount; index++) {

profile = getPlatformInfo(platforms[index], CL_PLATFORM_PROFILE);
version = getPlatformInfo(platforms[index], CL_PLATFORM_VERSION);
name = getPlatformInfo(platforms[index], CL_PLATFORM_NAME);
vendor = getPlatformInfo(platforms[index], CL_PLATFORM_VENDOR);
extensions = getPlatformInfo(platforms[index], CL_PLATFORM_EXTENSIONS);

printf("\nPlatform profile: %s ", profile);
printf("\nPlatform version: %s ", version);
printf("\nPlatform name: %s ", name);
printf("\nPlatform vendor: %s ", vendor);
printf("\nPlatform extensions: %s ", extensions);
printf("\n");

free(profile);
free(version);
free(name);
free(vendor);
free(extensions);

}

free(platforms);

printf("\n\n\tPress any key to exit...\n");
getch();
}

Expand Down

0 comments on commit c05ea97

Please sign in to comment.