next up previous


CIS 367: INTRODUCTION TO PARALLEL COMPUTING
Spring 1998
Programming Assignment 6

Due Date: noon, Monday May 25, 1998 (with no late submissions after noon Tuesday, May 26 in order to submit final grades

Objectives

The objective of this assignment is to code using derived data types and communicators and intercommunicators, and see applications where you might want to use these constructs. There is no experimental report, just coding!

Reference

Textbook, chapter 6 and 7.

Required Part: Derived Data Types

1.
Write the code for the function in Programming Assignment 1(a) on page 109 of your textbook. Process 0 should use a loop of receives which use a derived data type created by MPI_Type_vector. The other processes can use MPI_Type_contiguous to send a contiguous block to Process 0.

2.
In the main program, declare your arrays statically such that the grid on process 0 is the full grid of size 16 by 16, and the local grids are 16 by 4, initially. Use #define's for the sizes of these arrays.

3.
Compile and run your program that calls this print function for number of processes = 4. Now, change your #defines and compile and run your program to work for 8 processes, with local grid sizes 16 by 2.

4.
Hand in: One version of your code and script of your runs.

Extra Credit: Client/Server through Communicators

Create an MPI program that splits the processes in MPI_COMM_WORLD into a communicator consisting of ``server" processes and a communicator of ``client" processes. You can split them any way you like as long as there are an equal number of servers and clients. The server set should have a master server which is the only server that receives requests from the client processes directly. The master server can receive messages from any client, and as it receives these messages it sends the requests along with the rank of the client that sent it (identified from the master server's receive statement) to a second server. This second server, the ``worker" server, should receive messages from the master server, perform its ``service" of adding 2 to the number received, and then send the result directly back to the original client. The worker server should not send any messages back to the master server. It sends directly back the original client.

In this program, no communication should be done through MPI_COMM_WORLD. All communication should be done through the server and client communicators and an intercommunicator which you set up.

For grading purposes, each client should send 10 messages, the first being its rank, the second being its rank+1, third being rank+2,... You can assume that the servers know how many messages they will receive. For extra credit, you can have the servers work in a way that they will take any unknown number of messages and service them.

Note that only 2 of the servers actually are involved in this particular assignment.

Printing instructions: Your program should print the following information:

Compile and run your program.

Hand in the program and a script of one run.

About this document ...

This document was generated using the LaTeX2HTML translator Version 98.1p1 release (March 2nd, 1998)

Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.

The command line arguments were:
latex2html -split 0 lab6.tex.

The translation was initiated by Lori Pollock on 1998-05-14


next up previous
Lori Pollock
1998-05-14