Monday April 13, 2015
Your challenge is to use the OpenCL framework to run a number of simulations in parallel, each of which calculates a value for the mathematical constant pi.
You are given as starter code a program that calculates a value for pi. This starter code is provided below in the "OpenCL Pi starter zip file".
You should first download this file, read the README and the beginning comment in the openclpi.c file to understand how the program works, use the Makefile to build the program, and run the program to see the default value of pi given.
Next, you should become familiar with the code in the "OpenCL Heat solution zip file" below, which provides an example of using OpenCL. This is based on the HPCU "OpenCL Heat" challenge problem, which you are encouraged to review: http://hpcuniversity.org/students/weeklyChallenge/95/
Finally, you should change the "OpenCL Pi starter zip file" code to run an OpenCL program, in which the entire simulation of calculating pi is carried out by an OpenCL kernel N times, where N is the value for the work group size given by clGetKernelWorkGroupInfo().
Within the OpenCL kernel, you should use get_global_id(0) as the value for the number of rectangles used for an individual copy of the simulation. The kernel should produce an output buffer with N items, each of which contains the value of pi for a given simulation.
The result of running your program should look something like the openclpi.out file.
Your solution should also update the README to include a description of the system you used to run OpenCL, as well as any setup instructions one would need to follow to run your code on a similar system.
You should first download this file, read the README and the beginning comment in the openclpi.c file to understand how the program works, use the Makefile to build the program, and run the program to see the default value of pi given.
Next, you should become familiar with the code in the "OpenCL Heat solution zip file" below, which provides an example of using OpenCL. This is based on the HPCU "OpenCL Heat" challenge problem, which you are encouraged to review: http://hpcuniversity.org/students/weeklyChallenge/95/
Finally, you should change the "OpenCL Pi starter zip file" code to run an OpenCL program, in which the entire simulation of calculating pi is carried out by an OpenCL kernel N times, where N is the value for the work group size given by clGetKernelWorkGroupInfo().
Within the OpenCL kernel, you should use get_global_id(0) as the value for the number of rectangles used for an individual copy of the simulation. The kernel should produce an output buffer with N items, each of which contains the value of pi for a given simulation.
The result of running your program should look something like the openclpi.out file.
Your solution should also update the README to include a description of the system you used to run OpenCL, as well as any setup instructions one would need to follow to run your code on a similar system.
Show solution
Challenge Resources:
OpenCL Pi starter zip file
—
zip file containing starter code for the OpenCL Pi challenge problem.
OpenCL Heat solution zip file
—
zip file containing a solution to the OpenCL Heat challenge problem.
OpenCL Pi solution zip file
—
zip file containing a solution to the OpenCL Pi challenge problem.
©19942022

Shodor

Privacy Policy

NSDL

XSEDE

Blue Waters

ACM SIGHPC






XSEDE Code of Conduct

Not Logged In. Login