# HG changeset patch # User Yuhi TOMARI # Date 1360580543 -32400 # Node ID 53e22a570937b7efe1ab00094674ffa5394c04d8 # Parent e38bef2012bc9450a89897388cd03ad240dcafac add gpuInfo opencl example diff -r e38bef2012bc -r 53e22a570937 printGpuInfo/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/printGpuInfo/Makefile Mon Feb 11 20:02:23 2013 +0900 @@ -0,0 +1,11 @@ +CFLAGS = -Wall -framework opencl +CC = clang++ +OPT = -g + +TARGET=printInfo + +printInfo : printGpuInfo.o + $(CC) $(OPT) $(CFLAGS) -o $@ $? + +clean: + rm -rf *.o $(TARGET) \ No newline at end of file diff -r e38bef2012bc -r 53e22a570937 printGpuInfo/printGpuInfo.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/printGpuInfo/printGpuInfo.cc Mon Feb 11 20:02:23 2013 +0900 @@ -0,0 +1,19 @@ +#include +#include +int main() { + cl_int work_item_dim; + size_t work_item_sizes[3]; + size_t work_group_size; + cl_platform_id platform_id; + cl_uint ret; + cl_device_id device_id; + clGetPlatformIDs(1, &platform_id, &ret); + clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU, 1, &device_id, &ret); + clGetDeviceInfo(device_id, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(cl_uint), &work_item_dim, NULL); + clGetDeviceInfo(device_id, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(work_item_sizes), work_item_sizes, NULL); + clGetDeviceInfo(device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &work_group_size, NULL); + printf("Max work-item dimensions : %d \n",work_item_dim); + printf("Max work-item work-item sizes : %ld %ld %ld \n",work_item_sizes[0],work_item_sizes[1],work_item_sizes[2]); + printf("Max work-group size: %ld \n",work_group_size); + return 0; +}