Parameters in kernel reference device sizes.

Instead of MPI node sizes.
Fixes a pair of references to B matrix.
Merges last commit with previous version.

It was right when A was on the left. Now works on both sides.