Homework 2

Assignments: All parts are to be solved individually (turned in electronically, no ZIP files or tarballs, written parts in ASCII text, NO Word, postscript, PDF etc. permitted unless explicitly stated). All filenames must be exactly what is requested, capitalization included.

Please use the ARC cluster for this assignment. All programs have to be written in C, translated with mpicc/gcc and turned in with a corresponding Makefile.

  1. (10 points) Learn how to compile and execute a CUDA program. Wait to start this problem until after the September 6 lecture.

    There are several methods to measure Pi which is a constant that is used to calculate the circumference of a circle from that circle's radius or diameter. One of these methods is the Leibniz formula for Pi:

    Follow the lecture / obtain the corresponding code and write the CUDA code by replacing the integration method with the Leibniz formula (Leibniz_pi.c). More information about the Leibniz formula for Pi.

    Turn in p2.cu (CUDA file), p2.Makefile and p2.README (Explaining the implementation).

  2. (50 points) Group problem (3 per group)

    We will extend the methods of the last HW into two dimensions.

    Download, extract, compile the code lake.tar

    This program models the surface of a lake, where some pebbles have been thrown onto the surface. The program works as follows. In the spatial domain, a centralized finite difference is used to inform a zone of how to update itself using the information from its neighbors

    The time domain does something similarly, but here using information from the previous two times

    The program runs two versions of the algorithm, a CPU version, and a skeleton GPU version. Your task is to fill in the GPU algorithm to solve the same problem. Instructions:

    V0:


    V1: V2: V3:

    Include in p3.README a discussion of your results. Your discussion should include answering the following questions:

    Hints:

    Turn in p3.README, lake.cu/lakegpu.cu (version V2), lake_mpi.cu/lakegpu_mpi.cu (version V3), p3.Makefile

  3. Peer evaluation: Each group member must submit a peer.txt evaluation form.

What to turn in for programming assignments: