Assignment for Parallel Programming using C++ and MPI
Matrix.h
andMatrix.cpp
conduct Matrix-Vector Multiplication.Trap.h
andTrap.cpp
conduct Trapezoidal Integral.OddEvenSorting.h
andOddEvenSorting.cpp
conduct Odd Even Sort.MPIApp.cpp
contains the main function.
- compile with mpic++ (using c++11 with argument
-std=c++11
)
mpic++ -std=c++11 -c Matrix.cpp Trap.cpp OddEvenSorting.cpp MPIApp.cpp
- link with g++
mpic++ Matrix.o Trap.o OddEvenSorting.o MPIApp.o -o app
- use app
# default arguments:
# total = 10000
# m = 500
# n = 500
mpirun -np $(#process) app 1 # test Matrix-Vector Multiplication
mpirun -np $(#process) app 1 $(total) # specify the total number of tests
mpirun -np $(#process) app 1 $(m) $(n) # specify the shape (m*n) of the matrix
mpirun -np $(#process) app 1 $(total) $(m) $(n) # specify the total number of tests, and the shape (m*n) of the matrix
# default arguments:
# total = 10000
# range = 100
# n = 1000000
mpirun -np $(#process) app 2 # test Trapezoidal Integral
mpirun -np $(#process) app 2 $(range) $(n) # specify the range of the integral interval and the number of trapezoids
mpirun -np $(#process) app 2 $(total) $(range) $(n) # specify the total number of tests, the range of the integral interval and the number of trapezoids
# default arguments:
# total = 10000
# n = 10000
mpirun -np $(#process) app 3 # test Odd Even Sort
mpirun -np $(#process) app 3 $(n) # specify the list length
mpirun -np $(#process) app 3 $(total) $(n) # specify the total number of tests and the list length
- Any other command will be rejected by the application.
- Matrix-Vector Multiplication
- Trapezoidal Integral
- Odd Even Sorting