 
  
  
   
CSE 6362: Parallel Algorithms for Artificial Intelligence 
Homework Assignment #1 
 
Assigned:  January 23, 1997 
 
Due:  February 6, 1997 
 .  Each child process sends its local sum back to
the host, which then computes and outputs the global sum.  Message passing is
implemented using a shared file.
 .  Each child process sends its local sum back to
the host, which then computes and outputs the global sum.  Message passing is
implemented using a shared file.
To help you, a sample child program is given below.
#include <stdio.h>
main(argc, argv)
   int argc;
   char *argv[];
{
   int i, size, id, sum=0;
   char data[80];
   FILE *fp;
   size = atoi(argv[1]);
   id = atoi(argv[2]);
   fp = fopen("data", "a");
   for (i=0; i<size; i++)
      sum += (id * size) + i;
   fprintf(fp, "%d\n", sum);
}
Send your answers, your code and sample output to cs6362-turnin@cse.  Have fun!