Chapel Exercise
Setup
Log in to the cluster (preferably with the "-X" flag to enable X11 forwarding). Make sure you have Chapel initialized in your environment:
$ source /shared/bin/chapel_setup.sh $ chpl --version
The output should look like the following:
chpl Version 1.16.0 Copyright (c) 2004-2017, Cray Inc. (See LICENSE file for more details)
Copy the following folders (recursively) into your home folder somewhere:
/shared/cs470/chpl-hello /shared/cs470/chpl-cray
Part 1: Hello World
Look through the first part of the chpl-hello example. Build the program with "make" and run it with "./hello -nl 1" (this will automatically run on the cluster--you don't need to invoke srun or salloc manually). Try running with multiple locales. Gradually enable the rest of the program by removing the exit() calls, re-compiling, and testing it.
After you understand what the program is doing, run the accompanying test script (read it first!) and observe the demonstrated trends. Try making some tweaks and see how your changes affect the output of the program. YOU DO NOT NEED TO SUBMIT ANYTHING FROM THIS FOLDER.
Part 2: Ray Tracer
The main portion of the exercise is in the chpl-cray folder. The c-ray.chpl file contains most of the code for a simple serial raytracer. It's a bit lengthy, but thankfully you won't have to modify it much to make it parallel. In fact, you can ignore most of the declarations and everything below the marked line. You can also ignore Image.chpl.
When you're ready to begin work, read the comments at the top of c-ray.chpl (and fill in your names!) then work your way through the steps described in main() to finish the raytracer and then parallelize it.
The instructions are given in the source, but just for reference here is what the resulting image will look like BEFORE you make any modifications to the file:
Here is what it should look like after you successfully declare an array and invoke the raytracing routine to fill in all the pixels:
Submission
Submit your modified c-ray.chpl file (with accompanying analysis in the comments) to the appropriate Canvas assignment. You will be graded on the correctness of your Chapel code as well as the accuracy and completeness of your analysis.