Assignment 8 cs494-unp revised 11/9/99 Assigned: October 26, 1999 Due: November 12, 1999, 6:00pm Objective: heterogeneous distributed computing Points: 40 Description: Develop a TCP client/server program to do numerical integration of a given function (ref. ~dunigan/cs494-unp/pi.c). The server starts up each of the client programs, awaits connections from the clients, then distributes the work to the clients and awaits the results. The server measures the elapsed time from the beginning of the work distribution until the final result is calculated. The server should take list of hostnames (clients, max of 10) pi_serv cetus1b cetus1c cetus1d cetus1e The client should take the following required arguments pi_cli server port Use the library routines that you developed in assignment 7. The server should do the following: 1. establish a server port (let system assign port and use getsockname() to get assigned port) 2. fork a child process for each client, and use system() to start the cli_pi, e.g. "rsh host pi_cli serverhost port" 3. then await connections from each client, a loop is fine. print connecting hostname for each client connect 4. after all n clients are connected, start timer and send specific work description (e.g., starting partition number, sub-partition count, total rectangles) to clients in a loop 5. await partial results from clients using select() (Note: be sure to clear bits in select bitmask on end-of-file from sockets) 6. zero the partial-result buffer before each partial result is read. 7. After all partial results are returned, stop timer and print result, elapsed time, number of clients, and megaflops (see sample output below) Use XDR (probably xdrmem_create(), xdr_setpos(), etc.) for the work arguments to the client and the result from the client. I recommend you get the client/server running without XDR first, then add in the XDR calls. The data exchanged should be integers and double's -- not strings. You can use gethostname() to get the name of host your server is running on. You don't really need to worry about SIGCHLD. Use a minimum of 10,000,000 rectangles in your server. Place makefile, program and results of a serial code run (pi.c), a run with one client and server on same node, and a run with a server, and 4 clients. Typical server output might look like: pi_serv cetus1b cetus1c cetus1d cetus1e server waiting for 4 clients on port 62349 connection from CETUS1B.CS.UTK.EDU connection from CETUS1C.CS.UTK.EDU connection from CETUS1D.CS.UTK.EDU connection from CETUS1E.CS.UTK.EDU pi 3.141593 4 CPUs 1.390736 secs 43.14 Mflops Reference ~dunigan/cs494-unp/pi.c Optional: please indicate amount of time required to complete assignment. Use ~dunigan/cs494-unp/494submit to submit your source files and output. See http://www.cs.utk.edu/~dunigan/cs494-unp/policy.txt