CSE 6220 Programming Assignment 3
Code structure
All the code is located at the root level of the project.
The gtest
folder contains the Google Test Unit Testing framework version 1.7.
There are multiple header and .cpp files, your implementation will go into the following files:
jacobi.cpp
: Implement the sequential algorithm for Jacobi's method according to the function declarations injacobi.h
mpi_jacobi.cpp
: Implement the parallel algorithm according to the declarations inmpi_jacobi.h
.utils.h
andutils.cpp
: Implement common utility functions in these filesseq_tests.cpp
: Unit tests for the sequential code, implement your own test cases in herempi_tests.cpp
: Unit tests for the parallel MPI code. Implement your own test cases for all declared functions in here.
Other files containing code that you should not change are:
main.cpp
: Implements code for the main executablejacobi
. This does input/output reading and calling of the actual functions.io.h
: implements IO functions and random input generationmpi_gtest.cpp
: MPI wrapper for the GTest framework
Utility scripts (you may play around with these to generate your own custom input):
generate_input.py
: Python script to generate inputs. You can modify this code to generate different inputs.check_output.py
: Checks whether the output fromjacobi
is correct, by comparing the output with pythons numpy implementation.
Compiling
In order to compile everything, simply run
make all
Running Tests
For running all tests do:
make test
You can also run the two tests (sequential/MPI) separately by either:
./seq_tests
or
mpirun -np 4 ./mpi_tests
Useful commands
Mac OS cannot run more than 2 processors on one cmd application, so the --oversubscribe tag is needed Not sure how about Windows.
Run the tests (I added one more matrix mul test.)
mpirun -np 4 --oversubscribe ./mpi_tests
If you want to run the mpi_jacobi() function @ mpi_jaccobi.cpp, you can try this
mpirun -np 4 --oversubscribe ./jacobi -n 4
Also, if you want to try mpi_matrix_vector_mult() function @ mpi_jaccobi.cpp, you can change the distributed_jacobi() to distributed_matrix_vector_mult() with some necessary params changed.