Flops pf MatMult is less than expected
Hello, I have a sparse matrix A. Its size is 494 x 494. It has 1666 nonzeros. I call MatMult(A, x, y). From the profiling result (got by -log_summary), I find MatMult's flops is 2838. I think the flops should be nnz x 2 = 1666 x 2 = 3332. I don't know how PETSc got this number (2838). I also observed the phenomena with other matrices. It seems PETSc always give smaller flops. Why? Thank you! -- Junchao Zhang
On Fri, Dec 30, 2011 at 4:30 PM, Junchao Zhang <[email protected]>wrote:
Hello, I have a sparse matrix A. Its size is 494 x 494. It has 1666 nonzeros. I call MatMult(A, x, y). From the profiling result (got by -log_summary), I find MatMult's flops is 2838. I think the flops should be nnz x 2 = 1666 x 2 = 3332. I don't know how PETSc got this number (2838). I also observed the phenomena with other matrices. It seems PETSc always give smaller flops. Why?
There is 1 fewer adds than multiplies in every row: 3332-494 = 2838 Matt
Thank you! -- Junchao Zhang
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
Because 2838 + 494 = 3332, I believe PETSc calculates flops of an inner product as n-1, where n is the vector length. On Fri, Dec 30, 2011 at 4:30 PM, Junchao Zhang <[email protected]>wrote:
Hello, I have a sparse matrix A. Its size is 494 x 494. It has 1666 nonzeros. I call MatMult(A, x, y). From the profiling result (got by -log_summary), I find MatMult's flops is 2838. I think the flops should be nnz x 2 = 1666 x 2 = 3332. I don't know how PETSc got this number (2838). I also observed the phenomena with other matrices. It seems PETSc always give smaller flops. Why?
Thank you! -- Junchao Zhang
-- Junchao Zhang
participants (2)
-
Junchao Zhang -
Matthew Knepley