$40.99
Task
Write an OpenCL program that does the following:
Allow the user to enter whether he/she wants to use a CPU or a GPU device. Based on the user’s selection, search the system for all CPU or GPU devices. (Note that some systems have multiple CPUs and GPUs).mark)
Based on the user’s choice, display the following information for each CPU/GPU device that is available on the system: o Name of the platform(s) that support that deviceDevice type – CPU or GPU
(hint: CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU) o Device name
Number of compute units
(hint: CL_DEVICE_MAX_COMPUTE_UNITS) o Maximum work group size
(hint: CL_DEVICE_MAX_WORK_GROUP_SIZE) o Maximum work item sizes
(hint: CL_DEVICE_MAX_WORK_ITEM_SIZES) o Global memory size
(hint: CL_DEVICE_GLOBAL_MEM_SIZE)
mark)
Based on the devices available, allow the user to select one device. Check whether the device supports the cl_khr_icd extension (hint: CL_DEVICE_EXTENSIONS). Create a context and a command queue for that device. (1 mark)
Read the program source code from the provided “source.cl” file and build the program. Display whether or not the program built successfully and display the program build log (display the build log even if the program built successfully. Note: for some compilers, the build log will be empty if successful).mark)
Find and display the number of kernels in the program. Create kernels from the program and display all the kernel function names.mark)
Screenshots
Include screenshots with your submission to demonstrate that the program works on your computer. The screenshots should capture the input and output of your program. Use one of the common image formats (i.e. jpg/png/bmp).