This repository is a collection of various solutions for problems trying to solve them with multiprocessing. All are done in C language, using two open source libraries: OpenMP and MPI.
In this section, the code tries to solve a ransomware that shuffles images so they are unusable. This ransomware interchanges rows and columns randomly. The code tries to search first by rows, then by columns, which pixels are the most similar for each row/column and rearranges them. An example is shown above;
Different approaches have been made for computing this problem;
- restore1.c -> This version tries to run in parallel the functions that calculates the distance (difference in pixels between two rows/columns), and that swaps rows/columns.
- restore2.c -> This other version tries to run in parallel the loop that searches for the similar row/column and that swaps rows/columns.
- restore3.c -> Same implementation as restore2, however this one gives information about how many threads have been made and how many iterations have done.
For all the above results, we have used static planification as is the one that gives better results.
To run this code: $ ./restore -i image_in.ppm -o image_out.ppm -b block_size
Where the options are:
-i Input image "default"=in.ppm
-o Output image "default"=out.ppm If "" no output image will be generated
-w Block width "default"=8
-h Block height "default"=8
-b Block size
OpenMP: https://www.openmp.org/
- Calculates PI using the above equation, where each process calculates a part of the integral.
mpi_pi.c
- Usual ping-pong program wich calculates the time it takes a massage to go from its sender to its receiver. This is creates by two processes (sender & receiver)
ping-pong.c
- Program that generates newton fractals. The first one is an implementation on master-workers, where the master only tells what the workers shouls work on. The second aproach is also an implementation of master-workers, however in this case, the master also works.
newton_fractals.c, newton_fractals1.c
- Calculates the matrix-vector product. First by allocating blocks of rows of M. Secondly by allocating blocks of columns.
mxv1.c, mxv2.c
- Program that calculates a linear ecuation system. The first program does this by allocating blocks of rows. The second one does this by a cyclic distribution of the rows.
sistbf.c, sistcf