-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
40 lines (31 loc) · 1013 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifdef __APPLE__
#include <OpenCL/OpenCL.h>
#else
#include <CL/cl.h>
#endif
#include "opencl_target.h"
enum { STRLEN = 128 };
int main(int argc, char **argv)
{
cl_platform_id platform_id = NULL;
cl_device_id device_id = NULL;
if (argc == 1) {
opencl_target_env(&platform_id, &device_id);
} else {
opencl_target_str(&platform_id, &device_id, argv[1]);
}
if (device_id == NULL) {
printf("No matching device found!\n");
return EXIT_FAILURE;
}
char platform_name[STRLEN];
clGetPlatformInfo(platform_id, CL_PLATFORM_NAME, STRLEN, platform_name, NULL);
printf("Platform: %s\n", platform_name);
char device_name[STRLEN];
clGetDeviceInfo(device_id, CL_DEVICE_NAME, STRLEN, device_name, NULL);
printf("Device : %s\n", device_name);
char device_version[STRLEN];
clGetDeviceInfo(device_id, CL_DEVICE_VERSION, STRLEN, device_version, NULL);
printf("Version : %s\n", device_version);
return EXIT_SUCCESS;
}