Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write an OpenCL program that does the following: Find all available CPU and GPU devices on a system and allow the user to select one
Write an OpenCL program that does the following: Find all available CPU and GPU devices on a system and allow the user to select one of the available devices. Based on the user's choice, display the following information for that device: o Name of the platform that supports that device o Device type - CPU or GPU (CL_DEVICE_TYPE - either CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU) O Device name (CL_DEVICE_NAME) o Number of compute units (CL_DEVICE_MAX_COMPUTE_UNITS) o Maximum work group size (CL_DEVICE_MAX_WORK_GROUP_SIZE) o Maximum number of work item dimensions (CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS) o Maximum work item sizes (CL_DEVICE_MAX_WORK_ITEM_SIZES) o Global memory size (CL_DEVICE_GLOBAL_MEM_SIZE) o Local memory size (CL_DEVICE_LOCAL_MEM_SIZE) (2 marks) Create a context and a command queue for the selected device. (1 mark) Read the program source code from the provided task1.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). (1 mark) Find and display the number of kernels in the program. Create kernels from the program and display all kernel names. (1 mark) Write an OpenCL program that does the following: Find all available CPU and GPU devices on a system and allow the user to select one of the available devices. Based on the user's choice, display the following information for that device: o Name of the platform that supports that device o Device type - CPU or GPU (CL_DEVICE_TYPE - either CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_GPU) O Device name (CL_DEVICE_NAME) o Number of compute units (CL_DEVICE_MAX_COMPUTE_UNITS) o Maximum work group size (CL_DEVICE_MAX_WORK_GROUP_SIZE) o Maximum number of work item dimensions (CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS) o Maximum work item sizes (CL_DEVICE_MAX_WORK_ITEM_SIZES) o Global memory size (CL_DEVICE_GLOBAL_MEM_SIZE) o Local memory size (CL_DEVICE_LOCAL_MEM_SIZE) (2 marks) Create a context and a command queue for the selected device. (1 mark) Read the program source code from the provided task1.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). (1 mark) Find and display the number of kernels in the program. Create kernels from the program and display all kernel names. (1 mark)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started