Lab04: Parallel Mandelbrot

Objective
To "parallelize" an MPI program that plots the Mandelbrot set using MPE graphics.
download mandelbrot.c

(Original UNC Charlotte version of assignment): HTML version, PDF Version

This assignment comes from UNC at Charlotte, Parallel Programming Group

Background material on Mandelbrot sets: Iteration, Bifurcation, and Chaos and
Mandelbrot and Julia sets by Don Hyatt

  • Steps for compiling and running an MPE graphics file
    1. The file needs to be named with a ".c" extension
    2. Compile: mpecc filename
      (no .c here)
    3. Run: mperun -np 4 filename
      "-np 4" means 4 processes, you can vary the number of processes
    4. More helpful links on MPE graphics

  • Now time your program in order to measure the efficiency of your parallelization
    in relation to the number of processes you use.

    Hint: After MPE_Update( graph );
     
         startTime = MPI_Wtime();  //put this before the computations start
         
         . . .
          
         // After all the computations are over...
            
         MPE_Update( graph );
         
         if (rank > 0)
            MPI_Send(&rank, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
          
    	/* Program Finished */
    
        if (rank == 0) { 
            for (i = 1; i < size; i++)
    	{
    	    MPI_Recv(&processID, 1, MPI_INT, MPI_ANY_SOURCE, 0, 
    	               MPI_COMM_WORLD, &status);
    	    printf("Process %d is done\n", processID);
    	   
    	}
    	endTime = MPI_Wtime();
    	printf("Total time=%lf\n", endTime-startTime);
    	getchar();      //Pause for a key to be pressed
        }