Initial commit.
Add demo of parallel matrix multiplication. It computes wrong results for > 31 rows and needs to be fixed.
- Add asserts() to many cases where we blindly assume values to be correct
- Don't assume datatype of matrix elements to be int blindly in size computations. Instead use the actual sizeof() the elements.
Fix very very stupid mistake which broke computation for large matrices:
The send buffer of the async sends was being allocated on the stack, which would of course cause it to be overwritten randomly at some point in the future.
Add missing cleanup upon error exit of main()
Use NULL instead of 0 for pointers
Actually fill the matrices with random numbers:
If we don't use srand(), the numbers returned by rand() will be the same upon every execution of the program.
Add copy of matrix-multiplication which shall be changed into a simple version. The simple version should demonstrate how to debug MPI programs.
Add matric-multiply-simple-debug to compile.sh
- Remove the arrays "rows" and "cols" and use the defined ROWS and COLS as row/colcount for ALL matrices instead. This example shall be very simple so we use square matrices only and therefore can use a global row/col count
- Don't intialize rank/node-count so we get compiler warnings if they are used before initialization.
- Remove some documentation to make this example program more compact
Fix API usage: Use MPI_STATUS_IGNORE instead of NULL when we don't want a status.
Convert all asynchronous send to synchronous send code for more simplicity
I decided to use something simpler than matrix multiplication as a debug tutorial. For getting a more simple solution, I considered to reduce the dimension count of our problem from 2 to 1. Matrices are 2-dimensional arrays, so we instead use a bare one-dimensional array now. And instead of a complex algorithm as matrix multiplication, we just sum the array up.
Use "item" instead of "element" as name for the array contents. Its shorter.
Randomize array in a function instead of in the send loop. This will allow us to get rid of the inner send loop and instead send all integers which belong to one node in a single large send.
- Fix major bugs in items_per_rank computation: The quotient was reversed. Also, the divisor needs to be substracted by 1.
- Don't put the items in the "correct" array position on the slaves. It doesn't matter where they are there because each one has the whole array for itself.
Fix major bug in item send loop
Send all items at once instead of having a single send for each one. Reduces line count and increases performance.
Re-introduce putting the items into the "correct" position into the array on the slaves. This will be used to introduce an off-by-one bug which results in SIGSEGV and. This off-by-one-bug will be what the user of the tutorial shall find.
Reduce line count and improve documentation.