On 5 Jan 2015, at 09:39, David Ham <David.Ham@imperial.ac.uk> wrote:
On 5 January 2015 at 09:37, Cotter, Colin J <colin.cotter@imperial.ac.uk> wrote: Oh yes, good isolation of the problem.
If alpha also depends on values of A, do we have a problem there too?
Yes. Same problem. There is no current way for a parallel loop to read the entries of a matrix.
You could do this by creating a new output matrix, looping over the rows of the input matrix: out = A.duplicate() start, end = A.getOwnershipRange() for row in range(start, end): acol, aval = A.getRow(row) alphacol, alphaval = alpha.getRow(row) assert all(acol == alphacol), "Column pattern must match" val = aval * alphaval out.setValues(row, acol, val, addv=PETSc.InsertMode.INSERT_VALUES) out.assemble() Completely untested. Lawrence