联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-05-24 11:17

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 <yourusername>@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.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp