I have recently started trying to learn MPI to code in C. I am trying to write very small test codes to make sure I know what I'm doing as I go along. Unfortunately, I seem to be having an issue with one of them, which multiplies a matrix with a vector and outputs the resulting vector. Specifically, when I call:
MPI_Reduce(c, myc, 3, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
where myc is the part of the vector that is calculated by each processor, my final result is that c[i] = 0 for all i. The code that calculates myc is correct (checked using one processor and outputting myc instead of c). I assume I'm doing something very stupid here, but can't figure out what.