首页 > > 详细

COMP 3450讲解、辅导Technology留学生、讲解C++语言、C++程序设计调试 解析Haskell程序|解析Haskell程序

Wentworth Institute of Technology
COMP 3450 – Parallel and Distributed Computing
Summer 2019, Schuster
Lab Assignment 1
In this assignment you are to write a C program that preforms a matrix-vector product:
1. Login to reinhardt via ssh (ssh @reinhardt.cs.wit.edu)
2. Copy the folder named LA1 into your home directory. It is located in /assignments
3. There is one file, mvp-student.c, with “starter” code for you to build on. This will be the only
assignment where I start you with prewritten code.
4. When finished, compile the code according to what we covered in lecture.
5. Even though this is not a parallel code (we’ll do that next week) create a submission script and
submit to the cluster. Only request one node.
6. Include a makefile in your LA1 folder.
7. Write you code in a way that you can compute any size matrix-vector product.
However, I specifically want you to confirm that the following product works correctly:
The output of the matrix-vector program should look like:
2.00 1.00 0.00 0.00 0.00 1.00 3.00
1.00 2.00 1.00 0.00 0.00 1.00 4.00
0.00 1.00 2.00 1.00 0.00 1.00 = 4.00
0.00 0.00 1.00 2.00 1.00 1.00 4.00
0.00 0.00 0.00 1.00 2.00 1.00 3.00
In an effort to make parts of your code reusable in the future, I have provided you with two function
prototypes for the matrix-vector multiplication. However, you are required to include several more
functions: freeMat, assignMat, assignVec, printMatVec, allocVec, and allocMat.
The prototypes that I’ve given you are different in a subtle way. One takes the matrix as a double** and
the other takes a double*. Confirm that you understand the difference and test that both functions
produce the same output.
Include the appropriate function prototypes, including the one that I gave you, within a header file. To
include your own header, use #include “myheader.h” There is no need to compile header files since
they are passive code. Remember: header files do not contain regular code, only function prototypes (in
our case).
For the writeup that you upload to blackboard, discuss the implementation of the code, specifically about
the two different matvec prototype functions and how the work. Also, talk about how you might perform
this calculation in parallel. Provide some pseudocode if you find it useful and/or discuss what parts of the
code could be parallelized. Think about using both a shared memory system and a distributed memory
system and how their implementation might differ. There isn’t a wrong answer to these questions because
we haven’t covered the topics yet, however, I want you to begin to think about your code from a parallel
perspective.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!