Coders Packet

Max Number Search and Image smoothing in C and C++ using MPI

By Anish Kapoor

  • FinalProject2_AnishKapoor/
  • This project depicts the use of MPI directory for parallel implementation of two projects in C and C++ (along with serial implementations) : 1) Max number search. 2) Image smoothing.

    1) Max Number Search - a) Parallelizing the task to find maximum of numbers with implementation of MPI in which a master process reads whole input file, further dispatches its pieces to the workers, with pieces being of same size(higerst possibility). The master is also responsible for computation. Each and every processor is assigned to compute a local max which are ultimately collected by master. Master then finds the real max value from the local max values. The implementation of this algorithm does not contain collective communications. Only point to point communication is there.

    b) Perform the above task with collective communications.

    2) Image Smoothing - Image smoothing is done by convolution of the image by a kernel. The kernel is moved on the image and finds each pixel value after the smoothing operation. The input matrix which is square is stored in 'image.txt' whose first line gives the number of rows. After smoothing is done you have to multiply the resulting matrix with the 1/(sum of kernel values.). This program is responsible for writing resulting matrix to output file in the same format in which the input file is, without dimension.

    a) Serial program implementing the algorithm. b) The implementation of the above program using MPI where a master process is responsible for reading whole input file and then dispatching its rows to the workers, where each row is of equal size. Master is also responsible for computation process. Each processor makes the computation for its rows, their results are eventually collected by master. The implementation of the above program dont use any communications which are collective, only uses point-to-point communications. For the image borders, zero padding is used. And for the borders of row patches, neighbor rows are sent.

    Download Complete Code

    Comments

    Comments for the packet "Max Number Search and Image smoothing in C and C++ using MPI";
    No comments yet