A C-MPI parallel program that manipulates (by adding or multiplying) some 1D-2D arrays, all chosen by the user through a simple text menu.
Arrays to work with:
- A[1xN]
- B[Nx1]
- C[NxN]
- D[NxN]
Operations between the arrays:
- C+D
- C*B
- A*B
- B*A
Steps:
- input of the main dimension N for the arrays
- initialization of all 4 arrays
- choice of operation between arrays through text menu
Limitations:
- only MPI_Bcast()/MPI_Reduce()/MPI_Scatter()/MPI_Gather() functions used, except the first operation which MPI_Scatterv()/MPI_Gatherv() functions are used
- number of elements N of all arrays for all of the operations except the first one must be evenly divided by the number of the tasks
Guide to compile and run:
- download the .tar file from here: ftp:https://ftp.mcs.anl.gov/pub/mpi/old/mpich-1.2.4.tar.gz
- sudo apt-get install gcc
- sudo apt-get install libmpich2-dev
- mpicc -o mpi_array mpi_array.c
- mpiexec -n "number_of_tasks" ./mpi_array
Tested on Lubuntu 12.04 (Precise Pangolin) on a virtual machine.